creevey 0.9.0-non-webpack.2.fix-capture-element → 0.9.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 (535) hide show
  1. package/.yarnrc.yml +1 -0
  2. package/CHANGELOG.md +51 -0
  3. package/README.md +4 -3
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +5 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/client/addon/components/Addon.d.ts +8 -0
  8. package/dist/client/addon/components/Addon.js +57 -0
  9. package/dist/client/addon/components/Addon.js.map +1 -0
  10. package/{lib/types → dist}/client/addon/components/Icons.d.ts +7 -7
  11. package/dist/client/addon/components/Icons.js +18 -0
  12. package/dist/client/addon/components/Icons.js.map +1 -0
  13. package/{lib/types → dist}/client/addon/components/Panel.d.ts +9 -9
  14. package/dist/client/addon/components/Panel.js +35 -0
  15. package/dist/client/addon/components/Panel.js.map +1 -0
  16. package/{lib/types → dist}/client/addon/components/TestSelect.d.ts +8 -8
  17. package/dist/client/addon/components/TestSelect.js +33 -0
  18. package/dist/client/addon/components/TestSelect.js.map +1 -0
  19. package/dist/client/addon/components/Tools.d.ts +6 -0
  20. package/dist/client/addon/components/Tools.js +89 -0
  21. package/dist/client/addon/components/Tools.js.map +1 -0
  22. package/{lib/types/client/addon/Manager.d.ts → dist/client/addon/controller.d.ts} +38 -37
  23. package/dist/client/addon/controller.js +208 -0
  24. package/dist/client/addon/controller.js.map +1 -0
  25. package/dist/client/addon/decorator.d.ts +1 -0
  26. package/dist/client/addon/decorator.js +6 -0
  27. package/dist/client/addon/decorator.js.map +1 -0
  28. package/dist/client/addon/index.d.ts +2 -0
  29. package/dist/client/addon/index.js +19 -0
  30. package/dist/client/addon/index.js.map +1 -0
  31. package/dist/client/addon/manager.d.ts +1 -0
  32. package/dist/client/addon/manager.js +41 -0
  33. package/dist/client/addon/manager.js.map +1 -0
  34. package/dist/client/addon/preset.d.ts +2 -0
  35. package/dist/client/addon/preset.js +6 -0
  36. package/dist/client/addon/preset.js.map +1 -0
  37. package/dist/client/addon/preview.d.ts +4 -0
  38. package/dist/client/addon/preview.js +8 -0
  39. package/dist/client/addon/preview.js.map +1 -0
  40. package/{lib/types → dist}/client/addon/readyForCapture.d.ts +6 -6
  41. package/dist/client/addon/readyForCapture.js +7 -0
  42. package/dist/client/addon/readyForCapture.js.map +1 -0
  43. package/{lib/types → dist}/client/addon/utils.d.ts +3 -2
  44. package/dist/client/addon/utils.js +27 -0
  45. package/dist/client/addon/utils.js.map +1 -0
  46. package/{lib/types → dist}/client/addon/withCreevey.d.ts +25 -24
  47. package/dist/client/addon/withCreevey.js +286 -0
  48. package/dist/client/addon/withCreevey.js.map +1 -0
  49. package/dist/client/shared/components/ImagesView/BlendView.d.ts +5 -0
  50. package/dist/client/shared/components/ImagesView/BlendView.js +74 -0
  51. package/dist/client/shared/components/ImagesView/BlendView.js.map +1 -0
  52. package/dist/client/shared/components/ImagesView/ImagesView.d.ts +9 -0
  53. package/dist/client/shared/components/ImagesView/ImagesView.js +46 -0
  54. package/dist/client/shared/components/ImagesView/ImagesView.js.map +1 -0
  55. package/dist/client/shared/components/ImagesView/SideBySideView.d.ts +5 -0
  56. package/dist/client/shared/components/ImagesView/SideBySideView.js +121 -0
  57. package/dist/client/shared/components/ImagesView/SideBySideView.js.map +1 -0
  58. package/dist/client/shared/components/ImagesView/SlideView.d.ts +5 -0
  59. package/dist/client/shared/components/ImagesView/SlideView.js +136 -0
  60. package/dist/client/shared/components/ImagesView/SlideView.js.map +1 -0
  61. package/dist/client/shared/components/ImagesView/SwapView.d.ts +5 -0
  62. package/dist/client/shared/components/ImagesView/SwapView.js +72 -0
  63. package/dist/client/shared/components/ImagesView/SwapView.js.map +1 -0
  64. package/{lib/types/client/shared/components/ImagesView/ImagesView.d.ts → dist/client/shared/components/ImagesView/common.d.ts} +15 -24
  65. package/dist/client/shared/components/ImagesView/common.js +14 -0
  66. package/dist/client/shared/components/ImagesView/common.js.map +1 -0
  67. package/dist/client/shared/components/ImagesView/index.d.ts +5 -0
  68. package/dist/client/shared/components/ImagesView/index.js +14 -0
  69. package/dist/client/shared/components/ImagesView/index.js.map +1 -0
  70. package/dist/client/shared/components/PageFooter/PageFooter.d.ts +6 -0
  71. package/dist/client/shared/components/PageFooter/PageFooter.js +20 -0
  72. package/dist/client/shared/components/PageFooter/PageFooter.js.map +1 -0
  73. package/{lib/types → dist}/client/shared/components/PageFooter/Paging.d.ts +7 -7
  74. package/dist/client/shared/components/PageFooter/Paging.js +51 -0
  75. package/dist/client/shared/components/PageFooter/Paging.js.map +1 -0
  76. package/{lib/types → dist}/client/shared/components/PageHeader/ImagePreview.d.ts +14 -12
  77. package/dist/client/shared/components/PageHeader/ImagePreview.js +61 -0
  78. package/dist/client/shared/components/PageHeader/ImagePreview.js.map +1 -0
  79. package/{lib/types → dist}/client/shared/components/PageHeader/PageHeader.d.ts +14 -16
  80. package/dist/client/shared/components/PageHeader/PageHeader.js +93 -0
  81. package/dist/client/shared/components/PageHeader/PageHeader.js.map +1 -0
  82. package/dist/client/shared/components/ResultsPage.d.ts +20 -0
  83. package/dist/client/shared/components/ResultsPage.js +87 -0
  84. package/dist/client/shared/components/ResultsPage.js.map +1 -0
  85. package/{lib/types → dist}/client/shared/creeveyClientApi.d.ts +10 -9
  86. package/dist/client/shared/creeveyClientApi.js +56 -0
  87. package/dist/client/shared/creeveyClientApi.js.map +1 -0
  88. package/{lib/types → dist}/client/shared/helpers.d.ts +47 -46
  89. package/dist/client/shared/helpers.js +396 -0
  90. package/dist/client/shared/helpers.js.map +1 -0
  91. package/{lib/types → dist}/client/shared/viewMode.d.ts +4 -4
  92. package/dist/client/shared/viewMode.js +11 -0
  93. package/dist/client/shared/viewMode.js.map +1 -0
  94. package/dist/client/web/202.js +1 -0
  95. package/dist/client/web/270.js +43 -0
  96. package/dist/client/web/752.js +1 -0
  97. package/{lib/types → dist}/client/web/CreeveyApp.d.ts +11 -11
  98. package/dist/client/web/CreeveyApp.js +167 -0
  99. package/dist/client/web/CreeveyApp.js.map +1 -0
  100. package/{lib/types → dist}/client/web/CreeveyContext.d.ts +14 -11
  101. package/dist/client/web/CreeveyContext.js +41 -0
  102. package/dist/client/web/CreeveyContext.js.map +1 -0
  103. package/dist/client/web/CreeveyLoader.d.ts +3 -0
  104. package/dist/client/web/CreeveyLoader.js +52 -0
  105. package/dist/client/web/CreeveyLoader.js.map +1 -0
  106. package/{lib/types → dist}/client/web/CreeveyView/SideBar/Checkbox.d.ts +22 -19
  107. package/dist/client/web/CreeveyView/SideBar/Checkbox.js +86 -0
  108. package/dist/client/web/CreeveyView/SideBar/Checkbox.js.map +1 -0
  109. package/{lib/types → dist}/client/web/CreeveyView/SideBar/Search.d.ts +6 -6
  110. package/dist/client/web/CreeveyView/SideBar/Search.js +125 -0
  111. package/dist/client/web/CreeveyView/SideBar/Search.js.map +1 -0
  112. package/{lib/types → dist}/client/web/CreeveyView/SideBar/SideBar.d.ts +14 -14
  113. package/dist/client/web/CreeveyView/SideBar/SideBar.js +111 -0
  114. package/dist/client/web/CreeveyView/SideBar/SideBar.js.map +1 -0
  115. package/dist/client/web/CreeveyView/SideBar/SideBarFooter.d.ts +1 -0
  116. package/dist/client/web/CreeveyView/SideBar/SideBarFooter.js +32 -0
  117. package/dist/client/web/CreeveyView/SideBar/SideBarFooter.js.map +1 -0
  118. package/{lib/types → dist}/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +12 -12
  119. package/dist/client/web/CreeveyView/SideBar/SideBarHeader.js +113 -0
  120. package/dist/client/web/CreeveyView/SideBar/SideBarHeader.js.map +1 -0
  121. package/dist/client/web/CreeveyView/SideBar/SuiteLink.d.ts +43 -0
  122. package/dist/client/web/CreeveyView/SideBar/SuiteLink.js +123 -0
  123. package/dist/client/web/CreeveyView/SideBar/SuiteLink.js.map +1 -0
  124. package/{lib/types → dist}/client/web/CreeveyView/SideBar/TestLink.d.ts +7 -7
  125. package/dist/client/web/CreeveyView/SideBar/TestLink.js +64 -0
  126. package/dist/client/web/CreeveyView/SideBar/TestLink.js.map +1 -0
  127. package/{lib/types → dist}/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +12 -10
  128. package/dist/client/web/CreeveyView/SideBar/TestStatusIcon.js +59 -0
  129. package/dist/client/web/CreeveyView/SideBar/TestStatusIcon.js.map +1 -0
  130. package/dist/client/web/CreeveyView/SideBar/TestsStatus.d.ts +11 -0
  131. package/dist/client/web/CreeveyView/SideBar/TestsStatus.js +76 -0
  132. package/dist/client/web/CreeveyView/SideBar/TestsStatus.js.map +1 -0
  133. package/{lib/types → dist}/client/web/CreeveyView/SideBar/Toggle.d.ts +6 -6
  134. package/dist/client/web/CreeveyView/SideBar/Toggle.js +69 -0
  135. package/dist/client/web/CreeveyView/SideBar/Toggle.js.map +1 -0
  136. package/dist/client/web/CreeveyView/SideBar/index.d.ts +1 -0
  137. package/dist/client/web/CreeveyView/SideBar/index.js +6 -0
  138. package/dist/client/web/CreeveyView/SideBar/index.js.map +1 -0
  139. package/{lib/types → dist}/client/web/KeyboardEventsContext.d.ts +15 -13
  140. package/dist/client/web/KeyboardEventsContext.js +116 -0
  141. package/dist/client/web/KeyboardEventsContext.js.map +1 -0
  142. package/{lib/types → dist}/client/web/index.d.ts +4 -4
  143. package/{lib/cjs → dist}/client/web/index.html +12 -3
  144. package/dist/client/web/index.js +75 -0
  145. package/dist/client/web/index.js.map +1 -0
  146. package/dist/client/web/main.js +79 -0
  147. package/{lib/cjs → dist}/client/web/main.js.LICENSE.txt +0 -15
  148. package/{lib/types → dist}/creevey.d.ts +1 -1
  149. package/dist/creevey.js +52 -0
  150. package/dist/creevey.js.map +1 -0
  151. package/dist/index.d.ts +5 -0
  152. package/dist/index.js +24 -0
  153. package/dist/index.js.map +1 -0
  154. package/{lib/types → dist}/server/config.d.ts +4 -4
  155. package/dist/server/config.js +86 -0
  156. package/dist/server/config.js.map +1 -0
  157. package/{lib/types → dist}/server/docker.d.ts +7 -7
  158. package/dist/server/docker.js +122 -0
  159. package/dist/server/docker.js.map +1 -0
  160. package/{lib/types → dist}/server/index.d.ts +2 -2
  161. package/dist/server/index.js +47 -0
  162. package/dist/server/index.js.map +1 -0
  163. package/{lib/types → dist}/server/logger.d.ts +10 -10
  164. package/dist/server/logger.js +25 -0
  165. package/dist/server/logger.js.map +1 -0
  166. package/{lib/types → dist}/server/master/api.d.ts +7 -7
  167. package/dist/server/master/api.js +54 -0
  168. package/dist/server/master/api.js.map +1 -0
  169. package/dist/server/master/index.d.ts +3 -0
  170. package/dist/server/master/index.js +110 -0
  171. package/dist/server/master/index.js.map +1 -0
  172. package/{lib/types → dist}/server/master/master.d.ts +7 -7
  173. package/dist/server/master/master.js +40 -0
  174. package/dist/server/master/master.js.map +1 -0
  175. package/{lib/types → dist}/server/master/pool.d.ts +30 -31
  176. package/dist/server/master/pool.js +186 -0
  177. package/dist/server/master/pool.js.map +1 -0
  178. package/{lib/types → dist}/server/master/runner.d.ts +23 -26
  179. package/dist/server/master/runner.js +222 -0
  180. package/dist/server/master/runner.js.map +1 -0
  181. package/dist/server/master/server.d.ts +2 -0
  182. package/dist/server/master/server.js +114 -0
  183. package/dist/server/master/server.js.map +1 -0
  184. package/{lib/types → dist}/server/messages.d.ts +26 -27
  185. package/dist/server/messages.js +222 -0
  186. package/dist/server/messages.js.map +1 -0
  187. package/{lib/types → dist}/server/selenium/browser.d.ts +19 -17
  188. package/dist/server/selenium/browser.js +640 -0
  189. package/dist/server/selenium/browser.js.map +1 -0
  190. package/dist/server/selenium/index.d.ts +2 -0
  191. package/dist/server/selenium/index.js +19 -0
  192. package/dist/server/selenium/index.js.map +1 -0
  193. package/{lib/types → dist}/server/selenium/selenoid.d.ts +3 -3
  194. package/dist/server/selenium/selenoid.js +120 -0
  195. package/dist/server/selenium/selenoid.js.map +1 -0
  196. package/dist/server/stories.d.ts +3 -0
  197. package/dist/server/stories.js +92 -0
  198. package/dist/server/stories.js.map +1 -0
  199. package/dist/server/storybook/providers/browser.d.ts +2 -0
  200. package/dist/server/storybook/providers/browser.js +60 -0
  201. package/dist/server/storybook/providers/browser.js.map +1 -0
  202. package/dist/server/storybook/providers/hybrid.d.ts +2 -0
  203. package/dist/server/storybook/providers/hybrid.js +59 -0
  204. package/dist/server/storybook/providers/hybrid.js.map +1 -0
  205. package/dist/server/telemetry.d.ts +2 -0
  206. package/dist/server/telemetry.js +196 -0
  207. package/dist/server/telemetry.js.map +1 -0
  208. package/{lib/types → dist}/server/testsFiles/parser.d.ts +8 -12
  209. package/dist/server/testsFiles/parser.js +50 -0
  210. package/dist/server/testsFiles/parser.js.map +1 -0
  211. package/dist/server/update.d.ts +2 -0
  212. package/dist/server/update.js +53 -0
  213. package/dist/server/update.js.map +1 -0
  214. package/dist/server/utils.d.ts +25 -0
  215. package/dist/server/utils.js +157 -0
  216. package/dist/server/utils.js.map +1 -0
  217. package/{lib/types → dist}/server/worker/chai-image.d.ts +5 -6
  218. package/dist/server/worker/chai-image.js +113 -0
  219. package/dist/server/worker/chai-image.js.map +1 -0
  220. package/{lib/types → dist}/server/worker/helpers.d.ts +8 -8
  221. package/dist/server/worker/helpers.js +57 -0
  222. package/dist/server/worker/helpers.js.map +1 -0
  223. package/dist/server/worker/index.d.ts +1 -0
  224. package/dist/server/worker/index.js +6 -0
  225. package/dist/server/worker/index.js.map +1 -0
  226. package/{lib/types → dist}/server/worker/reporter.d.ts +8 -8
  227. package/dist/server/worker/reporter.js +130 -0
  228. package/dist/server/worker/reporter.js.map +1 -0
  229. package/dist/server/worker/worker.d.ts +4 -0
  230. package/dist/server/worker/worker.js +212 -0
  231. package/dist/server/worker/worker.js.map +1 -0
  232. package/{lib/types → dist}/shared/index.d.ts +7 -7
  233. package/dist/shared/index.js +77 -0
  234. package/dist/shared/index.js.map +1 -0
  235. package/{lib/types → dist}/shared/serializeRegExp.d.ts +9 -9
  236. package/dist/shared/serializeRegExp.js +25 -0
  237. package/dist/shared/serializeRegExp.js.map +1 -0
  238. package/{lib/types → dist}/types.d.ts +461 -490
  239. package/dist/types.js +61 -0
  240. package/dist/types.js.map +1 -0
  241. package/docs/config.md +30 -30
  242. package/docs/tests.md +3 -3
  243. package/manager/package.json +3 -0
  244. package/package.json +116 -156
  245. package/preset/README.md +3 -0
  246. package/preset/package.json +3 -0
  247. package/preview/README.md +3 -0
  248. package/preview/package.json +3 -0
  249. package/src/cli.ts +3 -0
  250. package/src/client/addon/components/Addon.tsx +53 -0
  251. package/src/client/addon/components/Icons.tsx +28 -0
  252. package/src/client/addon/components/Panel.tsx +57 -0
  253. package/src/client/addon/components/TestSelect.tsx +48 -0
  254. package/src/client/addon/components/Tools.tsx +93 -0
  255. package/src/client/addon/controller.ts +224 -0
  256. package/src/client/addon/decorator.ts +3 -0
  257. package/src/client/addon/index.ts +2 -0
  258. package/src/client/addon/manager.ts +44 -0
  259. package/src/client/addon/preset.ts +3 -0
  260. package/src/client/addon/preview.ts +7 -0
  261. package/src/client/addon/readyForCapture.ts +9 -0
  262. package/src/client/addon/utils.tsx +24 -0
  263. package/src/client/addon/withCreevey.ts +326 -0
  264. package/src/client/shared/components/ImagesView/BlendView.tsx +71 -0
  265. package/src/client/shared/components/ImagesView/ImagesView.tsx +70 -0
  266. package/src/client/shared/components/ImagesView/SideBySideView.tsx +139 -0
  267. package/src/client/shared/components/ImagesView/SlideView.tsx +146 -0
  268. package/src/client/shared/components/ImagesView/SwapView.tsx +81 -0
  269. package/src/client/shared/components/ImagesView/common.ts +23 -0
  270. package/src/client/shared/components/ImagesView/index.ts +5 -0
  271. package/src/client/shared/components/PageFooter/PageFooter.tsx +26 -0
  272. package/src/client/shared/components/PageFooter/Paging.tsx +90 -0
  273. package/src/client/shared/components/PageHeader/ImagePreview.tsx +82 -0
  274. package/src/client/shared/components/PageHeader/PageHeader.tsx +129 -0
  275. package/src/client/shared/components/ResultsPage.tsx +122 -0
  276. package/src/client/shared/creeveyClientApi.ts +68 -0
  277. package/src/client/shared/helpers.ts +436 -0
  278. package/src/client/shared/viewMode.ts +10 -0
  279. package/src/client/web/CreeveyApp.tsx +230 -0
  280. package/src/client/web/CreeveyContext.tsx +26 -0
  281. package/src/client/web/CreeveyLoader.tsx +56 -0
  282. package/src/client/web/CreeveyView/SideBar/Checkbox.tsx +118 -0
  283. package/src/client/web/CreeveyView/SideBar/Search.tsx +140 -0
  284. package/src/client/web/CreeveyView/SideBar/SideBar.tsx +136 -0
  285. package/src/client/web/CreeveyView/SideBar/SideBarFooter.tsx +38 -0
  286. package/src/client/web/CreeveyView/SideBar/SideBarHeader.tsx +138 -0
  287. package/src/client/web/CreeveyView/SideBar/SuiteLink.tsx +137 -0
  288. package/src/client/web/CreeveyView/SideBar/TestLink.tsx +69 -0
  289. package/src/client/web/CreeveyView/SideBar/TestStatusIcon.tsx +64 -0
  290. package/src/client/web/CreeveyView/SideBar/TestsStatus.tsx +109 -0
  291. package/src/client/web/CreeveyView/SideBar/Toggle.tsx +85 -0
  292. package/src/client/web/CreeveyView/SideBar/index.ts +1 -0
  293. package/src/client/web/KeyboardEventsContext.tsx +121 -0
  294. package/src/client/web/index.html +28 -0
  295. package/src/client/web/index.tsx +63 -0
  296. package/src/creevey.ts +47 -0
  297. package/src/index.ts +4 -0
  298. package/src/server/config.ts +83 -0
  299. package/src/server/docker.ts +136 -0
  300. package/src/server/index.ts +51 -0
  301. package/{lib/esm/server/logger.js → src/server/logger.ts} +8 -7
  302. package/src/server/master/api.ts +59 -0
  303. package/src/server/master/index.ts +111 -0
  304. package/src/server/master/master.ts +47 -0
  305. package/src/server/master/pool.ts +203 -0
  306. package/src/server/master/runner.ts +245 -0
  307. package/src/server/master/server.ts +124 -0
  308. package/src/server/messages.ts +273 -0
  309. package/src/server/selenium/browser.ts +840 -0
  310. package/src/server/selenium/index.ts +2 -0
  311. package/src/server/selenium/selenoid.ts +154 -0
  312. package/src/server/stories.ts +133 -0
  313. package/src/server/storybook/providers/browser.ts +58 -0
  314. package/src/server/storybook/providers/hybrid.ts +70 -0
  315. package/src/server/telemetry.ts +212 -0
  316. package/src/server/testsFiles/parser.ts +62 -0
  317. package/src/server/update.ts +74 -0
  318. package/src/server/utils.ts +206 -0
  319. package/src/server/worker/chai-image.ts +147 -0
  320. package/src/server/worker/helpers.ts +61 -0
  321. package/src/server/worker/index.ts +1 -0
  322. package/src/server/worker/reporter.ts +170 -0
  323. package/src/server/worker/worker.ts +240 -0
  324. package/src/shared/index.ts +76 -0
  325. package/src/shared/serializeRegExp.ts +26 -0
  326. package/src/types.ts +501 -0
  327. package/types/chai.d.ts +0 -1
  328. package/types/global.d.ts +5 -0
  329. package/types/mocha.d.ts +1 -1
  330. package/addon/package.json +0 -4
  331. package/jest.config.js +0 -6
  332. package/lib/cjs/cli.js +0 -5
  333. package/lib/cjs/client/addon/Manager.js +0 -264
  334. package/lib/cjs/client/addon/components/Addon.js +0 -55
  335. package/lib/cjs/client/addon/components/Icons.js +0 -46
  336. package/lib/cjs/client/addon/components/Panel.js +0 -72
  337. package/lib/cjs/client/addon/components/TestSelect.js +0 -65
  338. package/lib/cjs/client/addon/components/Tools.js +0 -95
  339. package/lib/cjs/client/addon/decorator.js +0 -11
  340. package/lib/cjs/client/addon/index.js +0 -31
  341. package/lib/cjs/client/addon/preset.js +0 -62
  342. package/lib/cjs/client/addon/readyForCapture.js +0 -12
  343. package/lib/cjs/client/addon/register.js +0 -72
  344. package/lib/cjs/client/addon/utils.js +0 -38
  345. package/lib/cjs/client/addon/withCreevey.js +0 -346
  346. package/lib/cjs/client/shared/components/ImagesView/BlendView.js +0 -87
  347. package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +0 -92
  348. package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +0 -154
  349. package/lib/cjs/client/shared/components/ImagesView/SlideView.js +0 -166
  350. package/lib/cjs/client/shared/components/ImagesView/SwapView.js +0 -91
  351. package/lib/cjs/client/shared/components/ImagesView/index.js +0 -45
  352. package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +0 -50
  353. package/lib/cjs/client/shared/components/PageFooter/Paging.js +0 -94
  354. package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +0 -82
  355. package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +0 -119
  356. package/lib/cjs/client/shared/components/ResultsPage.js +0 -143
  357. package/lib/cjs/client/shared/creeveyClientApi.js +0 -76
  358. package/lib/cjs/client/shared/helpers.js +0 -411
  359. package/lib/cjs/client/shared/viewMode.js +0 -17
  360. package/lib/cjs/client/web/142.js +0 -2
  361. package/lib/cjs/client/web/142.js.LICENSE.txt +0 -12
  362. package/lib/cjs/client/web/32.js +0 -1
  363. package/lib/cjs/client/web/551.js +0 -1
  364. package/lib/cjs/client/web/566.js +0 -2
  365. package/lib/cjs/client/web/566.js.LICENSE.txt +0 -31
  366. package/lib/cjs/client/web/691.js +0 -2
  367. package/lib/cjs/client/web/691.js.LICENSE.txt +0 -8
  368. package/lib/cjs/client/web/725.js +0 -1
  369. package/lib/cjs/client/web/main.js +0 -2
  370. package/lib/cjs/creevey.js +0 -69
  371. package/lib/cjs/index.js +0 -62
  372. package/lib/cjs/server/config.js +0 -96
  373. package/lib/cjs/server/docker.js +0 -146
  374. package/lib/cjs/server/extract.js +0 -50
  375. package/lib/cjs/server/index.js +0 -83
  376. package/lib/cjs/server/loaders/babel/creevey-plugin.js +0 -86
  377. package/lib/cjs/server/loaders/babel/helpers.js +0 -469
  378. package/lib/cjs/server/loaders/babel/register.js +0 -124
  379. package/lib/cjs/server/loaders/hooks/mdx.js +0 -30
  380. package/lib/cjs/server/loaders/hooks/svelte.js +0 -65
  381. package/lib/cjs/server/loaders/webpack/compile.js +0 -293
  382. package/lib/cjs/server/loaders/webpack/creevey-loader.js +0 -179
  383. package/lib/cjs/server/loaders/webpack/dummy-hmr.js +0 -39
  384. package/lib/cjs/server/loaders/webpack/mdx-loader.js +0 -72
  385. package/lib/cjs/server/loaders/webpack/start.js +0 -41
  386. package/lib/cjs/server/logger.js +0 -48
  387. package/lib/cjs/server/master/api.js +0 -75
  388. package/lib/cjs/server/master/index.js +0 -146
  389. package/lib/cjs/server/master/master.js +0 -57
  390. package/lib/cjs/server/master/pool.js +0 -197
  391. package/lib/cjs/server/master/runner.js +0 -281
  392. package/lib/cjs/server/master/server.js +0 -129
  393. package/lib/cjs/server/messages.js +0 -264
  394. package/lib/cjs/server/selenium/browser.js +0 -672
  395. package/lib/cjs/server/selenium/index.js +0 -31
  396. package/lib/cjs/server/selenium/selenoid.js +0 -172
  397. package/lib/cjs/server/stories.js +0 -159
  398. package/lib/cjs/server/storybook/entry.js +0 -70
  399. package/lib/cjs/server/storybook/helpers.js +0 -159
  400. package/lib/cjs/server/storybook/providers/browser.js +0 -74
  401. package/lib/cjs/server/storybook/providers/hybrid.js +0 -84
  402. package/lib/cjs/server/storybook/providers/nodejs.js +0 -239
  403. package/lib/cjs/server/testsFiles/parser.js +0 -72
  404. package/lib/cjs/server/testsFiles/register.js +0 -48
  405. package/lib/cjs/server/update.js +0 -79
  406. package/lib/cjs/server/utils.js +0 -183
  407. package/lib/cjs/server/worker/chai-image.js +0 -142
  408. package/lib/cjs/server/worker/helpers.js +0 -69
  409. package/lib/cjs/server/worker/index.js +0 -15
  410. package/lib/cjs/server/worker/reporter.js +0 -108
  411. package/lib/cjs/server/worker/worker.js +0 -268
  412. package/lib/cjs/shared/index.js +0 -101
  413. package/lib/cjs/shared/serializeRegExp.js +0 -42
  414. package/lib/cjs/types.js +0 -74
  415. package/lib/esm/cli.js +0 -4
  416. package/lib/esm/client/addon/Manager.js +0 -248
  417. package/lib/esm/client/addon/components/Addon.js +0 -39
  418. package/lib/esm/client/addon/components/Icons.js +0 -31
  419. package/lib/esm/client/addon/components/Panel.js +0 -53
  420. package/lib/esm/client/addon/components/TestSelect.js +0 -51
  421. package/lib/esm/client/addon/components/Tools.js +0 -74
  422. package/lib/esm/client/addon/decorator.js +0 -2
  423. package/lib/esm/client/addon/index.js +0 -2
  424. package/lib/esm/client/addon/preset.js +0 -41
  425. package/lib/esm/client/addon/readyForCapture.js +0 -5
  426. package/lib/esm/client/addon/register.js +0 -51
  427. package/lib/esm/client/addon/utils.js +0 -31
  428. package/lib/esm/client/addon/withCreevey.js +0 -322
  429. package/lib/esm/client/shared/components/ImagesView/BlendView.js +0 -67
  430. package/lib/esm/client/shared/components/ImagesView/ImagesView.js +0 -69
  431. package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +0 -131
  432. package/lib/esm/client/shared/components/ImagesView/SlideView.js +0 -143
  433. package/lib/esm/client/shared/components/ImagesView/SwapView.js +0 -71
  434. package/lib/esm/client/shared/components/ImagesView/index.js +0 -5
  435. package/lib/esm/client/shared/components/PageFooter/PageFooter.js +0 -36
  436. package/lib/esm/client/shared/components/PageFooter/Paging.js +0 -80
  437. package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +0 -68
  438. package/lib/esm/client/shared/components/PageHeader/PageHeader.js +0 -97
  439. package/lib/esm/client/shared/components/ResultsPage.js +0 -115
  440. package/lib/esm/client/shared/creeveyClientApi.js +0 -67
  441. package/lib/esm/client/shared/helpers.js +0 -353
  442. package/lib/esm/client/shared/viewMode.js +0 -6
  443. package/lib/esm/creevey.js +0 -54
  444. package/lib/esm/index.js +0 -5
  445. package/lib/esm/server/config.js +0 -73
  446. package/lib/esm/server/docker.js +0 -123
  447. package/lib/esm/server/extract.js +0 -34
  448. package/lib/esm/server/index.js +0 -64
  449. package/lib/esm/server/loaders/babel/creevey-plugin.js +0 -72
  450. package/lib/esm/server/loaders/babel/helpers.js +0 -452
  451. package/lib/esm/server/loaders/babel/register.js +0 -103
  452. package/lib/esm/server/loaders/hooks/mdx.js +0 -15
  453. package/lib/esm/server/loaders/hooks/svelte.js +0 -49
  454. package/lib/esm/server/loaders/webpack/compile.js +0 -270
  455. package/lib/esm/server/loaders/webpack/creevey-loader.js +0 -158
  456. package/lib/esm/server/loaders/webpack/dummy-hmr.js +0 -32
  457. package/lib/esm/server/loaders/webpack/mdx-loader.js +0 -58
  458. package/lib/esm/server/loaders/webpack/start.js +0 -27
  459. package/lib/esm/server/master/api.js +0 -64
  460. package/lib/esm/server/master/index.js +0 -125
  461. package/lib/esm/server/master/master.js +0 -38
  462. package/lib/esm/server/master/pool.js +0 -176
  463. package/lib/esm/server/master/runner.js +0 -259
  464. package/lib/esm/server/master/server.js +0 -105
  465. package/lib/esm/server/messages.js +0 -232
  466. package/lib/esm/server/selenium/browser.js +0 -639
  467. package/lib/esm/server/selenium/index.js +0 -2
  468. package/lib/esm/server/selenium/selenoid.js +0 -149
  469. package/lib/esm/server/stories.js +0 -140
  470. package/lib/esm/server/storybook/entry.js +0 -46
  471. package/lib/esm/server/storybook/helpers.js +0 -98
  472. package/lib/esm/server/storybook/providers/browser.js +0 -60
  473. package/lib/esm/server/storybook/providers/hybrid.js +0 -64
  474. package/lib/esm/server/storybook/providers/nodejs.js +0 -217
  475. package/lib/esm/server/testsFiles/parser.js +0 -50
  476. package/lib/esm/server/testsFiles/register.js +0 -35
  477. package/lib/esm/server/update.js +0 -61
  478. package/lib/esm/server/utils.js +0 -142
  479. package/lib/esm/server/worker/chai-image.js +0 -130
  480. package/lib/esm/server/worker/helpers.js +0 -60
  481. package/lib/esm/server/worker/index.js +0 -1
  482. package/lib/esm/server/worker/reporter.js +0 -86
  483. package/lib/esm/server/worker/worker.js +0 -238
  484. package/lib/esm/shared/index.js +0 -78
  485. package/lib/esm/shared/serializeRegExp.js +0 -24
  486. package/lib/esm/types.js +0 -43
  487. package/lib/types/cli.d.ts +0 -1
  488. package/lib/types/client/addon/components/Addon.d.ts +0 -8
  489. package/lib/types/client/addon/components/Tools.d.ts +0 -6
  490. package/lib/types/client/addon/decorator.d.ts +0 -1
  491. package/lib/types/client/addon/index.d.ts +0 -2
  492. package/lib/types/client/addon/preset.d.ts +0 -23
  493. package/lib/types/client/addon/register.d.ts +0 -3
  494. package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +0 -3
  495. package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +0 -3
  496. package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +0 -3
  497. package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +0 -3
  498. package/lib/types/client/shared/components/ImagesView/index.d.ts +0 -5
  499. package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +0 -8
  500. package/lib/types/client/shared/components/ResultsPage.d.ts +0 -18
  501. package/lib/types/client/web/CreeveyLoader.d.ts +0 -2
  502. package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +0 -33
  503. package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +0 -9
  504. package/lib/types/client/web/CreeveyView/SideBar/index.d.ts +0 -1
  505. package/lib/types/index.d.ts +0 -2
  506. package/lib/types/server/extract.d.ts +0 -2
  507. package/lib/types/server/loaders/babel/creevey-plugin.d.ts +0 -1
  508. package/lib/types/server/loaders/babel/helpers.d.ts +0 -19
  509. package/lib/types/server/loaders/babel/register.d.ts +0 -5
  510. package/lib/types/server/loaders/hooks/mdx.d.ts +0 -1
  511. package/lib/types/server/loaders/hooks/svelte.d.ts +0 -1
  512. package/lib/types/server/loaders/webpack/compile.d.ts +0 -2
  513. package/lib/types/server/loaders/webpack/creevey-loader.d.ts +0 -4
  514. package/lib/types/server/loaders/webpack/dummy-hmr.d.ts +0 -10
  515. package/lib/types/server/loaders/webpack/mdx-loader.d.ts +0 -6
  516. package/lib/types/server/loaders/webpack/start.d.ts +0 -1
  517. package/lib/types/server/master/index.d.ts +0 -3
  518. package/lib/types/server/master/server.d.ts +0 -2
  519. package/lib/types/server/selenium/index.d.ts +0 -2
  520. package/lib/types/server/stories.d.ts +0 -8
  521. package/lib/types/server/storybook/entry.d.ts +0 -18
  522. package/lib/types/server/storybook/helpers.d.ts +0 -24
  523. package/lib/types/server/storybook/providers/browser.d.ts +0 -4
  524. package/lib/types/server/storybook/providers/hybrid.d.ts +0 -4
  525. package/lib/types/server/storybook/providers/nodejs.d.ts +0 -9
  526. package/lib/types/server/testsFiles/register.d.ts +0 -2
  527. package/lib/types/server/update.d.ts +0 -2
  528. package/lib/types/server/utils.d.ts +0 -20
  529. package/lib/types/server/worker/index.d.ts +0 -1
  530. package/lib/types/server/worker/worker.d.ts +0 -4
  531. package/preset.js +0 -9
  532. package/types/babel__register.d.ts +0 -1
  533. package/types/event-source-polyfill.d.ts +0 -6
  534. package/types/mdx.d.ts +0 -7
  535. /package/{addon → manager}/README.md +0 -0
@@ -1,64 +0,0 @@
1
- import cluster from 'cluster';
2
- import { readConfig, defaultBrowser } from './config';
3
- import { logger } from './logger'; // NOTE: Impure function, mutate config by adding gridUrl prop
4
-
5
- async function startWebdriverServer(config, options) {
6
- if (config.useDocker) {
7
- return (await import('./docker')).default(config, options.browser, async () => (await import('./selenium/selenoid')).startSelenoidContainer(config, options.debug));
8
- } else {
9
- return (await import('./selenium/selenoid')).startSelenoidStandalone(config, options.debug);
10
- }
11
- }
12
-
13
- export default async function (options) {
14
- const config = await readConfig(options);
15
- const {
16
- browser = defaultBrowser,
17
- extract,
18
- tests,
19
- update,
20
- webpack,
21
- ui,
22
- port
23
- } = options;
24
- if (!config) return; // NOTE: We don't need docker nor selenoid for webpack or update options
25
-
26
- if (!(config.gridUrl || Object.values(config.browsers).every(({
27
- gridUrl
28
- }) => gridUrl)) && !extract && !webpack && !tests && !update) {
29
- await startWebdriverServer(config, options);
30
- }
31
-
32
- switch (true) {
33
- case Boolean(extract) || tests:
34
- {
35
- return (await import('./extract')).default(config, options);
36
- }
37
-
38
- case Boolean(update):
39
- {
40
- return (await import('./update')).default(config, typeof update == 'string' ? update : undefined);
41
- }
42
-
43
- case webpack:
44
- {
45
- logger.info('Starting Webpack Compiler');
46
- return (await import('./loaders/webpack/compile')).default(config, options);
47
- }
48
-
49
- case cluster.isPrimary:
50
- {
51
- logger.info('Starting Master Process');
52
- const resolveApi = (await import('./master/server')).default(config.reportDir, port, ui);
53
- return (await import('./master')).default(config, options, resolveApi);
54
- }
55
-
56
- default:
57
- {
58
- logger.info(`Starting Worker for ${browser}`);
59
- return (await import('./worker')).default(config, { ...options,
60
- browser
61
- });
62
- }
63
- }
64
- }
@@ -1,72 +0,0 @@
1
- import path from 'path';
2
- import { commonVisitor, FileType, mdxVisitor, previewVisitor, storyVisitor } from './helpers';
3
- import { logger } from '../../logger';
4
- let lastStoryFile = null;
5
- const stories = new Set();
6
- const reexportedStories = new Map();
7
- export default function () {
8
- return {
9
- pre() {
10
- const parents = this.opts.parents() ?? [];
11
- const story = this.opts.story();
12
- this.resourcePath = this.filename;
13
- this.fileType = FileType.Invalid; // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
-
15
- this.visitedTopPaths = new Set();
16
- this.visitedBindings = new Set();
17
- this.reexportedStories = reexportedStories;
18
-
19
- if (story && this.filename.startsWith(story) || parents.find(parent => this.reexportedStories.has(parent))) {
20
- this.fileType = FileType.Story;
21
- this.isMDX = path.parse(this.filename).ext == '.mdx';
22
- lastStoryFile = this.filename;
23
- stories.add(this.filename);
24
- } else if (this.filename.startsWith(this.opts.preview)) this.fileType = FileType.Preview;else if (lastStoryFile && this.opts.debug) {
25
- logger.warn('Trying to transform possible non-story file', this.resourcePath, 'Please check the', lastStoryFile);
26
- lastStoryFile = null; // TODO Add link to docs, how creevey works and what user should do in this situation
27
- }
28
- },
29
-
30
- visitor: { ...commonVisitor,
31
-
32
- ExportAllDeclaration(path) {
33
- if (this.fileType == FileType.Story && typeof storyVisitor.ExportAllDeclaration == 'function') {
34
- storyVisitor.ExportAllDeclaration.call(this, path, this);
35
- }
36
- },
37
-
38
- ExportDefaultDeclaration(path) {
39
- if (this.fileType == FileType.Story && typeof storyVisitor.ExportDefaultDeclaration == 'function') {
40
- storyVisitor.ExportDefaultDeclaration.call(this, path, this);
41
- }
42
- },
43
-
44
- ExportNamedDeclaration(path) {
45
- if (this.fileType == FileType.Preview && typeof previewVisitor.ExportNamedDeclaration == 'function') {
46
- previewVisitor.ExportNamedDeclaration.call(this, path, this);
47
- }
48
-
49
- if (this.fileType == FileType.Story && typeof storyVisitor.ExportNamedDeclaration == 'function') {
50
- storyVisitor.ExportNamedDeclaration.call(this, path, this);
51
- }
52
- },
53
-
54
- CallExpression(path) {
55
- if (this.fileType == FileType.Preview && typeof previewVisitor.CallExpression == 'function') {
56
- previewVisitor.CallExpression.call(this, path, this);
57
- }
58
-
59
- if (this.fileType == FileType.Story && typeof storyVisitor.CallExpression == 'function') {
60
- storyVisitor.CallExpression.call(this, path, this);
61
- }
62
- },
63
-
64
- FunctionDeclaration(path) {
65
- if (this.isMDX && typeof mdxVisitor.FunctionDeclaration == 'function') {
66
- mdxVisitor.FunctionDeclaration.call(this, path, this);
67
- }
68
- }
69
-
70
- }
71
- };
72
- }
@@ -1,452 +0,0 @@
1
- import * as t from '@babel/types';
2
- import { isDefined } from '../../../types';
3
-
4
- function isExports(path) {
5
- const {
6
- parentPath
7
- } = path;
8
- return path.node.name == 'exports' && path.scope.hasGlobal('exports') && !path.scope.hasBinding('exports') && parentPath.isMemberExpression() && parentPath.get('object').isIdentifier({
9
- name: 'exports'
10
- });
11
- }
12
-
13
- function isModuleExports(path) {
14
- const {
15
- parentPath
16
- } = path;
17
- return path.node.name == 'module' && path.scope.hasGlobal('module') && !path.scope.hasBinding('module') && parentPath.isMemberExpression() && parentPath.get('object').isIdentifier({
18
- name: 'module'
19
- }) && parentPath.get('property').isIdentifier({
20
- name: 'exports'
21
- });
22
- }
23
-
24
- function isObjectAssign(path) {
25
- if (!(path !== null && path !== void 0 && path.isCallExpression())) return false;
26
- const calleePath = path.get('callee');
27
- return calleePath.isMemberExpression() && calleePath.get('object').isIdentifier({
28
- name: 'Object'
29
- }) && calleePath.get('property').isIdentifier({
30
- name: 'assign'
31
- });
32
- }
33
-
34
- function isTemplateBind(path) {
35
- if (!(path !== null && path !== void 0 && path.isCallExpression())) return false;
36
- const calleePath = path.get('callee');
37
- return calleePath.isMemberExpression() && calleePath.get('object').isIdentifier() && calleePath.get('property').isIdentifier({
38
- name: 'bind'
39
- });
40
- }
41
-
42
- function findRootPath(path) {
43
- return path.find(x => {
44
- var _x$parentPath;
45
-
46
- return Boolean((_x$parentPath = x.parentPath) === null || _x$parentPath === void 0 ? void 0 : _x$parentPath.isProgram());
47
- });
48
- }
49
-
50
- function getPropertyPath(path, name) {
51
- const propertyPath = path.get('properties').find(propPath => propPath.isObjectProperty() && t.isIdentifier(propPath.node.key, {
52
- name
53
- }));
54
- return propertyPath !== null && propertyPath !== void 0 && propertyPath.isObjectProperty() ? propertyPath : undefined;
55
- } // TODO Support import and process them
56
-
57
-
58
- function getDeclaratorPath(path) {
59
- if (path !== null && path !== void 0 && path.isIdentifier()) {
60
- const {
61
- path: bindingPath
62
- } = path.scope.getBinding(path.node.name) ?? {};
63
- if (bindingPath !== null && bindingPath !== void 0 && bindingPath.isVariableDeclarator() || bindingPath !== null && bindingPath !== void 0 && bindingPath.isFunctionDeclaration() || bindingPath !== null && bindingPath !== void 0 && bindingPath.isImportSpecifier()) return bindingPath;
64
- }
65
- }
66
-
67
- function getKindObjectNodePath(path) {
68
- if (path.isObjectExpression()) {
69
- return getPropertyPath(path, 'title') ? path : undefined;
70
- }
71
- }
72
-
73
- function getIdentifiers(path) {
74
- return path.map(x => x.isFunctionDeclaration() ? x.get('id') : x.get('id')).map(idPath => idPath.isIdentifier() ? idPath : null).filter(isDefined);
75
- }
76
-
77
- function removeAllPropsExcept(path, propNames) {
78
- const getPropName = propPath => propNames.find(names => {
79
- const keyPath = propPath.isObjectProperty() ? propPath.get('key') : propPath.get('key');
80
- if (!keyPath.isIdentifier()) return;
81
- const name = Array.isArray(names) ? names[0] : names;
82
- return typeof name == 'string' ? keyPath.isIdentifier({
83
- name
84
- }) : name(keyPath.node.name);
85
- });
86
-
87
- path.get('properties').forEach(propPath => {
88
- if (propPath.isObjectProperty() || propPath.isObjectMethod()) {
89
- const propName = getPropName(propPath);
90
- if (!propName) return propPath.remove();
91
- const restNames = Array.isArray(propName) ? propName.slice(1) : [];
92
- if (propPath.isObjectProperty() && restNames.length != 0) removeAllExpressionPropsExcept(propPath === null || propPath === void 0 ? void 0 : propPath.get('value'), restNames);
93
- if (propPath.isObjectMethod() && restNames[0] == 'storyName') replaceStoryFnToNoop(propPath);
94
- } else if (propPath.isSpreadElement()) {
95
- removeAllExpressionPropsExcept(propPath.get('argument'), propNames);
96
- } else propPath.remove();
97
- });
98
- }
99
-
100
- function removeAllPropAssignsExcept(propAssigns, propNames) {
101
- for (const [assignPath, props] of propAssigns ?? []) {
102
- const restNames = props.reduce((subPropNames, prop) => {
103
- const propName = subPropNames.find(names => {
104
- const name = Array.isArray(names) ? names[0] : names;
105
- return typeof name == 'string' ? name == prop : name(prop);
106
- });
107
- if (Array.isArray(propName)) return propName.slice(1);
108
- if (!propName) assignPath.remove();
109
- return [];
110
- }, propNames);
111
- if (restNames.length != 0) removeAllExpressionPropsExcept(assignPath.get('right'), restNames);
112
- }
113
- }
114
-
115
- function replaceStoryFnToNoop(path) {
116
- if (path !== null && path !== void 0 && path.isArrowFunctionExpression()) path.get('body').replaceWith(t.blockStatement([]));else if (path !== null && path !== void 0 && path.isFunctionDeclaration()) path.get('body').replaceWith(t.blockStatement([]));else if (path !== null && path !== void 0 && path.isFunctionExpression()) path.get('body').replaceWith(t.blockStatement([]));else if (path !== null && path !== void 0 && path.isObjectMethod()) path.get('body').replaceWith(t.blockStatement([]));
117
- }
118
-
119
- function getAssignmentPathWithProps(refPath) {
120
- const assignmentPath = refPath.findParent(parentPath => parentPath.isAssignmentExpression());
121
- if (!(assignmentPath !== null && assignmentPath !== void 0 && assignmentPath.isAssignmentExpression())) return;
122
- const props = [];
123
-
124
- for (let propPath = refPath.parentPath; propPath != assignmentPath; propPath = propPath.parentPath) {
125
- var _propPath;
126
-
127
- if (!((_propPath = propPath) !== null && _propPath !== void 0 && _propPath.isMemberExpression())) return;
128
- const propNode = propPath.node.property;
129
- if (!t.isIdentifier(propNode)) return;
130
- props.push(propNode.name);
131
- }
132
-
133
- if (props.length != 0) return [assignmentPath, props];
134
- }
135
-
136
- function getPropertyAssignmentPaths(idPaths) {
137
- const assignPaths = new Map();
138
- idPaths.forEach(idPath => {
139
- var _idPath$scope$getBind;
140
-
141
- const referencePaths = ((_idPath$scope$getBind = idPath.scope.getBinding(idPath.node.name)) === null || _idPath$scope$getBind === void 0 ? void 0 : _idPath$scope$getBind.referencePaths) ?? [];
142
- referencePaths.forEach(refPath => {
143
- const [assignmentPath, props] = getAssignmentPathWithProps(refPath) ?? [];
144
- if (assignmentPath && props) assignPaths.set(assignmentPath, props);
145
- });
146
- });
147
- return assignPaths;
148
- }
149
-
150
- function removeAllExpressionPropsExcept(expressionPath, propNames) {
151
- const resolvedDeclPath = getDeclaratorPath(expressionPath);
152
- if (expressionPath !== null && expressionPath !== void 0 && expressionPath.isObjectExpression()) removeAllPropsExcept(expressionPath, propNames);else if (expressionPath !== null && expressionPath !== void 0 && expressionPath.isCallExpression()) {
153
- if (isObjectAssign(expressionPath)) expressionPath.get('arguments').forEach(argumentPath => removeAllExpressionPropsExcept(argumentPath, storyProps));else if (isTemplateBind(expressionPath)) {
154
- const calleePath = expressionPath.get('callee');
155
- if (calleePath.isMemberExpression()) removeAllExpressionPropsExcept(calleePath.get('object'), propNames);
156
- } else if (propNames[0] == 'storyName') {
157
- expressionPath === null || expressionPath === void 0 ? void 0 : expressionPath.replaceWith(t.arrowFunctionExpression([], t.blockStatement([])));
158
- }
159
- } else if ((expressionPath !== null && expressionPath !== void 0 && expressionPath.isFunctionExpression() || expressionPath !== null && expressionPath !== void 0 && expressionPath.isArrowFunctionExpression()) && propNames[0] == 'storyName') replaceStoryFnToNoop(expressionPath);else if ((!resolvedDeclPath || resolvedDeclPath.isImportSpecifier()) && propNames[0] == 'storyName') expressionPath === null || expressionPath === void 0 ? void 0 : expressionPath.replaceWith(t.arrowFunctionExpression([], t.blockStatement([])));
160
-
161
- if (resolvedDeclPath) {
162
- if (!resolvedDeclPath.isImportSpecifier()) removeAllPropAssignsExcept(getPropertyAssignmentPaths(getIdentifiers([resolvedDeclPath])).entries(), propNames);
163
- if (resolvedDeclPath.isVariableDeclarator()) removeAllExpressionPropsExcept(resolvedDeclPath.get('init'), propNames);
164
- if (resolvedDeclPath.isFunctionDeclaration() && propNames[0] == 'storyName') replaceStoryFnToNoop(resolvedDeclPath);
165
- }
166
- }
167
-
168
- function cleanUpStoriesOfCallChain(storiesOfPath) {
169
- let callPath = storiesOfPath;
170
-
171
- do {
172
- const childCallPath = callPath;
173
- const {
174
- parentPath: memberPath
175
- } = childCallPath;
176
- if (!memberPath || !memberPath.isMemberExpression()) return;
177
- callPath = memberPath.parentPath;
178
- const propPath = memberPath.get('property');
179
- if (!callPath.isCallExpression()) return;
180
-
181
- if (propPath.isIdentifier({
182
- name: 'add'
183
- })) {
184
- const [, storyPath, parametersPath] = callPath.get('arguments');
185
- storyPath.replaceWith(t.arrowFunctionExpression([], t.blockStatement([])));
186
- removeAllExpressionPropsExcept(parametersPath, ['creevey']);
187
- } else if (propPath.isIdentifier({
188
- name: 'addDecorator'
189
- })) {
190
- callPath.replaceWith(childCallPath);
191
- } else if (propPath.isIdentifier({
192
- name: 'addParameters'
193
- })) {
194
- const [parametersPath] = callPath.get('arguments');
195
- removeAllExpressionPropsExcept(parametersPath, ['creevey']);
196
- }
197
- } while (callPath.parentPath != null);
198
- }
199
-
200
- function recursivelyRemoveUnreferencedBindings(path) {
201
- const getUnreferencedBindings = () => {
202
- path.scope.crawl();
203
- return Object.values(path.scope.bindings).filter(binding => !binding.referenced || binding.referencePaths.every(refPath => refPath.find(x => x.node == binding.path.node)));
204
- };
205
-
206
- let bindings = getUnreferencedBindings();
207
-
208
- do {
209
- bindings.forEach(binding => !binding.path.removed && binding.path.remove());
210
- } while ((bindings = getUnreferencedBindings()).length > 0);
211
- }
212
-
213
- function getUnvisitedRefs(paths, // eslint-disable-next-line @typescript-eslint/no-explicit-any
214
- state) {
215
- const rootPaths = [...new Set(paths.map(findRootPath).filter(isDefined))];
216
- const bindings = new Set();
217
- rootPaths.forEach(rootPath => {
218
- state.visitedTopPaths.add(rootPath);
219
- rootPath.traverse({
220
- Identifier(identifierPath) {
221
- const binding = identifierPath.scope.getBinding(identifierPath.node.name);
222
-
223
- if ((binding === null || binding === void 0 ? void 0 : binding.scope) == rootPath.scope && !state.visitedBindings.has(binding)) {
224
- bindings.add(binding);
225
- state.visitedBindings.add(binding);
226
- }
227
- }
228
-
229
- });
230
- });
231
- const refs = [].concat(...[...bindings].map(b => [b.path, ...b.referencePaths]));
232
- return [...new Set(refs)];
233
- }
234
-
235
- export let FileType;
236
-
237
- (function (FileType) {
238
- FileType[FileType["Invalid"] = -1] = "Invalid";
239
- FileType[FileType["Entry"] = 0] = "Entry";
240
- FileType[FileType["Preview"] = 1] = "Preview";
241
- FileType[FileType["Story"] = 2] = "Story";
242
- })(FileType || (FileType = {}));
243
-
244
- export const commonVisitor = {
245
- Program: {
246
- enter(path) {
247
- path.traverse({
248
- TSDeclareFunction(path) {
249
- path.remove();
250
- },
251
-
252
- TSTypeAliasDeclaration(path) {
253
- path.remove();
254
- },
255
-
256
- TSInterfaceDeclaration(path) {
257
- path.remove();
258
- },
259
-
260
- TSTypeAnnotation(path) {
261
- path.remove();
262
- },
263
-
264
- TSAsExpression(path) {
265
- path.replaceWith(path.get('expression'));
266
- }
267
-
268
- });
269
- },
270
-
271
- exit(path) {
272
- if (this.fileType != FileType.Story && this.fileType != FileType.Preview) return;
273
- recursivelyRemoveUnreferencedBindings(path);
274
- path.traverse({
275
- ImportDeclaration(path) {
276
- if (path.node.specifiers.length == 0) path.remove();
277
- }
278
-
279
- });
280
- let refs = [...this.visitedTopPaths];
281
-
282
- while (refs.length > 0) {
283
- refs = getUnvisitedRefs(refs, this);
284
- }
285
-
286
- path.get('body').filter(x => !this.visitedTopPaths.has(x)).forEach(x => x.remove());
287
- }
288
-
289
- }
290
- };
291
- export const previewVisitor = {
292
- ExportNamedDeclaration(namedPath) {
293
- this.visitedTopPaths.add(namedPath);
294
- const declarationPath = namedPath.get('declaration');
295
- if (!declarationPath.isVariableDeclaration()) return;
296
- declarationPath.get('declarations').forEach(declPath => {
297
- if (!declPath.isVariableDeclarator()) return;
298
- if (t.isIdentifier(declPath.node.id, {
299
- name: 'decorators'
300
- })) return declPath.remove();
301
-
302
- if (t.isIdentifier(declPath.node.id, {
303
- name: 'parameters'
304
- })) {
305
- removeAllExpressionPropsExcept(declPath.get('init'), ['creevey']);
306
- }
307
- });
308
- },
309
-
310
- CallExpression(rootCallPath) {
311
- const rootPath = findRootPath(rootCallPath);
312
- const calleePath = rootCallPath.get('callee');
313
- if (calleePath.isIdentifier({
314
- name: 'configure'
315
- }) && rootPath) this.visitedTopPaths.add(rootPath);else if (calleePath.isIdentifier({
316
- name: 'addDecorator'
317
- })) rootCallPath.remove();else if (calleePath.isIdentifier({
318
- name: 'addParameters'
319
- })) {
320
- const [argPath] = rootCallPath.get('arguments');
321
- if (!argPath || !argPath.isObjectExpression()) return;
322
- if (rootPath) this.visitedTopPaths.add(rootPath);
323
- removeAllPropsExcept(argPath, ['creevey']);
324
- }
325
- }
326
-
327
- };
328
- export const mdxVisitor = {
329
- FunctionDeclaration(functionPath) {
330
- var _functionPath$get$nod, _rootPath$scope$getBi;
331
-
332
- const functionName = (_functionPath$get$nod = functionPath.get('id').node) === null || _functionPath$get$nod === void 0 ? void 0 : _functionPath$get$nod.name;
333
- if (functionName != 'MDXContent') return;
334
- const rootPath = findRootPath(functionPath);
335
- const refs = (rootPath === null || rootPath === void 0 ? void 0 : (_rootPath$scope$getBi = rootPath.scope.getBinding(functionName)) === null || _rootPath$scope$getBi === void 0 ? void 0 : _rootPath$scope$getBi.referencePaths) ?? [];
336
- refs.forEach(refPath => {
337
- var _findRootPath;
338
-
339
- return (_findRootPath = findRootPath(refPath)) === null || _findRootPath === void 0 ? void 0 : _findRootPath.remove();
340
- });
341
- rootPath === null || rootPath === void 0 ? void 0 : rootPath.remove();
342
- }
343
-
344
- };
345
- const kindProps = ['title', 'id', ['parameters', 'creevey'], 'includeStories', 'excludeStories'];
346
- const storyProps = ['storyName', ['story', 'name', ['parameters', 'creevey', 'docsOnly']], ['parameters', 'creevey', 'docsOnly']];
347
- const exportsProps = [['default', ...kindProps], [name => name != 'default', ...storyProps]];
348
- export const storyVisitor = {
349
- ExportDefaultDeclaration(defaultPath) {
350
- const defaultDeclaration = defaultPath.get('declaration');
351
- const declaratorPath = getDeclaratorPath(defaultDeclaration);
352
- const kindPath = declaratorPath !== null && declaratorPath !== void 0 && declaratorPath.isVariableDeclarator() ? getKindObjectNodePath(declaratorPath.get('init')) : getKindObjectNodePath(defaultDeclaration);
353
- if (!kindPath) return;
354
- this.visitedTopPaths.add(defaultPath);
355
- removeAllPropsExcept(kindPath, kindProps);
356
- if (declaratorPath && !declaratorPath.isImportSpecifier()) removeAllPropAssignsExcept(getPropertyAssignmentPaths(getIdentifiers([declaratorPath])).entries(), kindProps);
357
- },
358
-
359
- ExportAllDeclaration(allPath) {
360
- const request = allPath.get('source').node.value;
361
- this.reexportedStories.set(this.resourcePath, (this.reexportedStories.get(this.resourcePath) ?? new Set()).add(request));
362
- this.visitedTopPaths.add(allPath);
363
- },
364
-
365
- ExportNamedDeclaration(namedPath) {
366
- this.visitedTopPaths.add(namedPath);
367
- const declarationPath = namedPath.get('declaration');
368
- let storyFnPropAssigns = new Map();
369
-
370
- if (declarationPath.isVariableDeclaration()) {
371
- const declarations = declarationPath.get('declarations');
372
- declarations.map(x => x.get('init')).forEach(initPath => removeAllExpressionPropsExcept(initPath, storyProps));
373
- storyFnPropAssigns = getPropertyAssignmentPaths(getIdentifiers(declarations));
374
- } else if (declarationPath.isFunctionDeclaration()) {
375
- replaceStoryFnToNoop(declarationPath);
376
- storyFnPropAssigns = getPropertyAssignmentPaths(getIdentifiers([declarationPath]));
377
- }
378
-
379
- removeAllPropAssignsExcept(storyFnPropAssigns.entries(), storyProps);
380
- },
381
-
382
- CallExpression(rootCallPath) {
383
- const rootPath = findRootPath(rootCallPath);
384
- if (!rootCallPath.get('callee').isIdentifier({
385
- name: 'storiesOf'
386
- })) return;
387
- if (rootPath) this.visitedTopPaths.add(rootPath);
388
-
389
- if (rootPath !== null && rootPath !== void 0 && rootPath.isVariableDeclaration()) {
390
- var _rootPath$get$find;
391
-
392
- const storiesIdPath = (_rootPath$get$find = rootPath.get('declarations').find(decl => decl.get('init') == rootCallPath)) === null || _rootPath$get$find === void 0 ? void 0 : _rootPath$get$find.get('id');
393
-
394
- if (storiesIdPath !== null && storiesIdPath !== void 0 && storiesIdPath.isIdentifier()) {
395
- var _storiesIdPath$scope$;
396
-
397
- (((_storiesIdPath$scope$ = storiesIdPath.scope.getBinding(storiesIdPath.node.name)) === null || _storiesIdPath$scope$ === void 0 ? void 0 : _storiesIdPath$scope$.referencePaths) ?? []).forEach(cleanUpStoriesOfCallChain);
398
- }
399
- }
400
-
401
- cleanUpStoriesOfCallChain(rootCallPath);
402
- },
403
-
404
- Identifier(identifierPath) {
405
- if (isExports(identifierPath)) {
406
- const rootPath = findRootPath(identifierPath);
407
- if (rootPath) this.visitedTopPaths.add(rootPath);
408
- const [assignmentPath, props] = getAssignmentPathWithProps(identifierPath) ?? [];
409
-
410
- if (assignmentPath && props) {
411
- if (props.length == 1 && props[0] != 'default') {
412
- const declaratorPath = getDeclaratorPath(assignmentPath.get('right'));
413
-
414
- if (declaratorPath && !declaratorPath.isImportSpecifier()) {
415
- removeAllPropAssignsExcept(getPropertyAssignmentPaths(getIdentifiers([declaratorPath])).entries(), storyProps);
416
- } else {
417
- const rightPath = assignmentPath.get('right');
418
-
419
- if (isObjectAssign(rightPath)) {
420
- rightPath.get('arguments').forEach(argumentPath => removeAllExpressionPropsExcept(argumentPath, storyProps));
421
- } else rightPath.replaceWith(t.arrowFunctionExpression([], t.blockStatement([])));
422
- }
423
- } else removeAllPropAssignsExcept(new Map([[assignmentPath, props]]).entries(), exportsProps);
424
- }
425
- }
426
-
427
- if (isModuleExports(identifierPath)) {
428
- const rootPath = findRootPath(identifierPath);
429
- if (rootPath) this.visitedTopPaths.add(rootPath);
430
- const [assignmentPath, props] = getAssignmentPathWithProps(identifierPath) ?? [];
431
-
432
- if (assignmentPath && props) {
433
- if (props.length == 1 && props[0] == 'exports') {
434
- removeAllExpressionPropsExcept(assignmentPath.get('right'), exportsProps);
435
- } else if (props.length == 2 && props[0] == 'exports' && props[1] != 'default') {
436
- const declaratorPath = getDeclaratorPath(assignmentPath.get('right'));
437
-
438
- if (declaratorPath && !declaratorPath.isImportSpecifier()) {
439
- removeAllPropAssignsExcept(getPropertyAssignmentPaths(getIdentifiers([declaratorPath])).entries(), storyProps);
440
- } else {
441
- const rightPath = assignmentPath.get('right');
442
-
443
- if (isObjectAssign(rightPath)) {
444
- rightPath.get('arguments').forEach(argumentPath => removeAllExpressionPropsExcept(argumentPath, storyProps));
445
- } else rightPath.replaceWith(t.arrowFunctionExpression([], t.blockStatement([])));
446
- }
447
- } else removeAllPropAssignsExcept(new Map([[assignmentPath, props]]).entries(), [['exports', ...exportsProps]]);
448
- }
449
- }
450
- }
451
-
452
- };
@@ -1,103 +0,0 @@
1
- import Module from 'module';
2
- import fs from 'fs';
3
- import { isAbsolute, join, relative, resolve } from 'path';
4
- import { addHook } from 'pirates';
5
- import { isDefined } from '../../../types';
6
- import { extensions } from '../../utils';
7
- import plugin from './creevey-plugin';
8
- import { hasDocsAddon, hasSvelteCSFAddon, isStorybookVersionLessThan } from '../../storybook/helpers';
9
- let parents = null;
10
- let story = null; //@ts-expect-error private field doesn't have types
11
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
12
-
13
- const jsLoader = Module._extensions['.js']; //@ts-expect-error private field doesn't have types
14
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
15
-
16
- Module._extensions['.js'] = function (mod, filename) {
17
- parents = Object.values(require.cache).filter(m => m === null || m === void 0 ? void 0 : m.children.includes(mod)).filter(isDefined).map(m => m.filename); // eslint-disable-next-line @typescript-eslint/no-unsafe-call
18
-
19
- jsLoader(mod, filename);
20
- parents = null;
21
- };
22
-
23
- addHook(() => '', {
24
- exts: ['.jpg', '.jpeg', '.png', '.gif', '.eot', '.otf', '.svg', '.ttf', '.woff', '.woff2', '.css', '.less', '.scss', '.styl'],
25
- ignoreNodeModules: false
26
- });
27
-
28
- function getRequireContext(rootDir) {
29
- return function requireContext(rootPath, deep, filter) {
30
- const ids = [];
31
- let contextPath; // Relative path
32
-
33
- if (rootPath.startsWith('.')) contextPath = resolve(rootDir, rootPath); // Module path
34
- else if (!isAbsolute(rootPath)) contextPath = require.resolve(rootPath); // Absolute path
35
- else contextPath = rootPath;
36
-
37
- const traverse = dirPath => {
38
- fs.readdirSync(dirPath, {
39
- withFileTypes: true
40
- }).forEach(dirent => {
41
- const filename = dirent.name;
42
- const filePath = join(dirPath, filename);
43
- if (dirent.isDirectory() && deep) return traverse(filePath);
44
- if (dirent.isFile() && ((filter === null || filter === void 0 ? void 0 : filter.test(`./${relative(contextPath, filePath)}`)) ?? true)) return ids.push(filePath);
45
- });
46
- };
47
-
48
- traverse(contextPath);
49
-
50
- const context = id => {
51
- story = id; // eslint-disable-next-line @typescript-eslint/no-var-requires
52
-
53
- const storyModule = require(id);
54
-
55
- story = null;
56
- return storyModule;
57
- };
58
-
59
- context.id = contextPath;
60
-
61
- context.keys = () => ids;
62
-
63
- context.resolve = id => id;
64
-
65
- return context;
66
- };
67
- }
68
-
69
- export default async function register(config, debug = false) {
70
- const rootDir = isStorybookVersionLessThan(6, 4) ? config.storybookDir : process.cwd();
71
- const requireContext = getRequireContext(rootDir);
72
- const preview = resolve(config.storybookDir, 'preview');
73
- if (hasDocsAddon()) await (await import('../hooks/mdx')).addMDXHook(() => story);
74
- if (hasSvelteCSFAddon()) await (await import('../hooks/svelte')).addSvelteHook(() => story); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
75
-
76
- (await import('@babel/register')).default(config.babelOptions({
77
- babelrc: false,
78
- rootMode: 'upward-optional',
79
- ignore: [/node_modules/],
80
- extensions: [...extensions, ...(hasDocsAddon() ? ['.mdx'] : []), ...(hasSvelteCSFAddon() ? ['.svelte'] : [])],
81
- parserOpts: {
82
- sourceType: 'module',
83
- plugins: ['classProperties', 'decorators-legacy', 'jsx', 'typescript']
84
- },
85
- plugins: [[plugin, {
86
- debug,
87
- preview,
88
- parents: () => parents,
89
- story: () => story
90
- }], ['@babel/plugin-transform-runtime', {
91
- // eslint-disable-next-line @typescript-eslint/no-var-requires
92
- version: require('@babel/helpers/package.json').version,
93
- absoluteRuntime: true,
94
- corejs: 3
95
- }]],
96
- presets: [['@babel/preset-env', {
97
- targets: {
98
- node: '10'
99
- }
100
- }]]
101
- }));
102
- return requireContext;
103
- }