erudit 3.0.0-dev.8 → 4.0.0-dev.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 (605) hide show
  1. package/app/app.vue +25 -185
  2. package/app/assets/icons/array-check.svg +3 -0
  3. package/app/assets/icons/array-lines.svg +3 -0
  4. package/app/assets/icons/array-star.svg +3 -0
  5. package/app/assets/icons/arrow/from-circle.svg +3 -0
  6. package/app/assets/icons/arrow/left.svg +3 -0
  7. package/app/assets/icons/arrow/outward-box.svg +3 -0
  8. package/app/assets/icons/arrow/outward.svg +3 -0
  9. package/app/assets/icons/arrow/to-circle.svg +3 -0
  10. package/app/assets/icons/arrow/up-to-right.svg +3 -0
  11. package/app/assets/icons/aside-open.svg +2 -2
  12. package/app/assets/icons/asterisk.svg +2 -2
  13. package/app/assets/icons/bell.svg +3 -0
  14. package/app/assets/icons/book-outline.svg +3 -0
  15. package/app/assets/icons/book-question.svg +2 -2
  16. package/app/assets/icons/book.svg +2 -2
  17. package/app/assets/icons/box.svg +3 -0
  18. package/app/assets/icons/bug.svg +2 -2
  19. package/app/assets/icons/chevron-right.svg +3 -0
  20. package/app/assets/icons/cog.svg +3 -0
  21. package/app/assets/icons/construction.svg +2 -2
  22. package/app/assets/icons/diamond.svg +3 -0
  23. package/app/assets/icons/draw.svg +2 -2
  24. package/app/assets/icons/erudit.svg +3 -0
  25. package/app/assets/icons/file-lines.svg +2 -2
  26. package/app/assets/icons/files.svg +3 -0
  27. package/app/assets/icons/flame.svg +3 -0
  28. package/app/assets/icons/folder-open.svg +2 -2
  29. package/app/assets/icons/folder.svg +2 -2
  30. package/app/assets/icons/globe.svg +2 -2
  31. package/app/assets/icons/graduation.svg +3 -0
  32. package/app/assets/icons/handshake.svg +3 -0
  33. package/app/assets/icons/house.svg +2 -2
  34. package/app/assets/icons/lines.svg +3 -0
  35. package/app/assets/icons/moon.svg +2 -2
  36. package/app/assets/icons/plus-circle.svg +2 -2
  37. package/app/assets/icons/plus.svg +2 -2
  38. package/app/assets/icons/puzzle.svg +2 -2
  39. package/app/assets/icons/question-circle.svg +3 -0
  40. package/app/assets/icons/rocket.svg +3 -0
  41. package/app/assets/icons/search/check.svg +3 -0
  42. package/app/assets/icons/search/dead.svg +3 -0
  43. package/app/assets/icons/search/glass.svg +3 -0
  44. package/app/assets/icons/search/wtf.svg +3 -0
  45. package/app/assets/icons/sun-moon.svg +2 -2
  46. package/app/assets/icons/sun.svg +2 -2
  47. package/app/assets/icons/translate.svg +3 -0
  48. package/app/assets/icons/user.svg +2 -2
  49. package/app/assets/icons/users.svg +2 -2
  50. package/app/assets/icons/warning.svg +3 -0
  51. package/app/components/EruditLink.ts +9 -0
  52. package/app/components/FancyBold.vue +17 -0
  53. package/app/components/FancyCard.vue +59 -0
  54. package/app/components/FancyCardTag.vue +16 -0
  55. package/app/components/Prose.vue +51 -0
  56. package/app/components/ScrollHolder.vue +20 -0
  57. package/app/components/SmartMedia.vue +112 -0
  58. package/app/components/ads/Ads.vue +39 -0
  59. package/app/components/ads/AdsBannerAside.vue +46 -0
  60. package/app/components/ads/AdsBannerBottom.vue +17 -0
  61. package/app/components/ads/AdsReplacer.vue +28 -0
  62. package/app/components/ads/provider/Custom.vue +19 -0
  63. package/app/components/ads/provider/Yandex.vue +84 -0
  64. package/app/components/aside/AsideListItem.vue +66 -74
  65. package/app/components/aside/AsideMajor.vue +8 -56
  66. package/app/components/aside/AsideMinor.vue +76 -71
  67. package/app/components/aside/AsidePlainMessage.vue +9 -0
  68. package/app/components/aside/AsideSwitch.vue +67 -0
  69. package/app/components/aside/major/PaneHolder.vue +106 -0
  70. package/app/components/aside/major/PaneSwitcher.vue +73 -0
  71. package/app/components/aside/major/PaneSwitcherButton.vue +38 -0
  72. package/app/components/aside/major/PaneTemplate.vue +5 -0
  73. package/app/components/aside/major/SiteInfo.vue +68 -85
  74. package/app/components/aside/major/contentNav/PaneBookNav.vue +116 -0
  75. package/app/components/aside/major/contentNav/PaneGlobalNav.vue +19 -0
  76. package/app/components/aside/major/contentNav/items/ContentNavBook.vue +21 -0
  77. package/app/components/aside/major/contentNav/items/ContentNavFolder.vue +92 -0
  78. package/app/components/aside/major/contentNav/items/ContentNavItem.vue +33 -0
  79. package/app/components/aside/major/contentNav/items/ContentNavPage.vue +18 -0
  80. package/app/components/aside/major/contentNav/items/ContentNavSeparator.vue +62 -0
  81. package/app/components/aside/major/contentNav/items/ContentNavTopic.vue +18 -0
  82. package/app/components/aside/major/contentNav/items/Flags.vue +52 -0
  83. package/app/components/aside/major/contentNav/items/ItemTemplate.vue +27 -0
  84. package/app/components/aside/major/languages/PaneLanguages.vue +55 -0
  85. package/app/components/aside/major/pages/PanePages.vue +60 -0
  86. package/app/components/aside/major/search/PaneSearch.vue +145 -0
  87. package/app/components/aside/major/search/SearchInput.vue +104 -0
  88. package/app/components/aside/major/search/SearchResult.vue +103 -0
  89. package/app/components/aside/major/search/SearchStatus.vue +48 -0
  90. package/app/components/aside/major/search/search.worker.ts +164 -0
  91. package/app/components/aside/major/settings/BuildTime.vue +25 -0
  92. package/app/components/aside/major/settings/EngineVersion.vue +13 -0
  93. package/app/components/aside/major/settings/PaneSettings.vue +17 -0
  94. package/app/components/aside/major/settings/ThemeSwitcher.vue +53 -0
  95. package/app/components/aside/major/settings/repository/Repository.vue +33 -0
  96. package/app/components/aside/major/settings/repository/SecondaryGitHub.vue +71 -0
  97. package/app/components/aside/minor/AsideMinorPane.vue +1 -11
  98. package/app/components/aside/minor/AsideMinorPlainHeader.vue +21 -0
  99. package/app/components/aside/minor/content/AsideMinorContentContributions.vue +51 -0
  100. package/app/components/aside/minor/content/AsideMinorContentPage.vue +37 -0
  101. package/app/components/aside/minor/content/AsideMinorContentTopic.vue +69 -0
  102. package/app/components/aside/minor/content/ButtonPaneContributions.vue +116 -0
  103. package/app/components/aside/minor/content/ButtonPaneImprove.vue +121 -0
  104. package/app/components/aside/minor/content/Contribution.vue +36 -0
  105. package/app/components/aside/minor/content/Toc.vue +163 -0
  106. package/app/components/aside/minor/content/TocItem.vue +77 -0
  107. package/app/components/aside/minor/content/TopicPartButton.vue +35 -0
  108. package/app/components/aside/minor/contributor/AsideMinorContributor.vue +39 -0
  109. package/app/components/aside/minor/contributor/ItemBook.vue +39 -0
  110. package/app/components/aside/minor/contributor/ItemContent.vue +17 -0
  111. package/app/components/aside/minor/news/AsideMinorNews.vue +133 -0
  112. package/app/components/aside/minor/news/NewsItem.vue +69 -0
  113. package/app/components/aside/minor/news/RenderNewsElement.vue +42 -0
  114. package/app/components/aside/minor/news/elements/Mix.vue +11 -0
  115. package/app/components/aside/minor/news/elements/P.vue +14 -0
  116. package/app/components/aside/minor/news/elements/Ref.vue +58 -0
  117. package/app/components/aside/minor/news/elements/Text.vue +18 -0
  118. package/app/components/indexPage/IndexPagePersons.vue +117 -0
  119. package/app/components/main/MainAction.vue +20 -0
  120. package/app/components/main/MainBreadcrumbs.vue +28 -0
  121. package/app/components/main/MainContentChild.vue +48 -0
  122. package/app/components/main/MainContentChildren.vue +14 -0
  123. package/app/components/main/MainDecoration.vue +15 -0
  124. package/app/components/main/MainDescription.vue +13 -0
  125. package/app/components/main/MainFlag.vue +133 -0
  126. package/app/components/main/MainFlags.vue +17 -0
  127. package/app/components/main/MainGlow.vue +12 -0
  128. package/app/components/main/MainQuickLink.vue +76 -0
  129. package/app/components/main/MainQuickLinks.vue +42 -0
  130. package/app/components/main/MainQuote.vue +162 -0
  131. package/app/components/main/MainQuoteLoader.vue +86 -0
  132. package/app/components/main/MainSection.vue +59 -0
  133. package/app/components/main/MainSectionPreamble.vue +5 -0
  134. package/app/components/main/MainSubTitle.vue +12 -0
  135. package/app/components/main/MainTitle.vue +33 -0
  136. package/app/components/main/MainTopicPartPage.vue +88 -0
  137. package/app/components/main/MainTopicPartSwitch.vue +71 -0
  138. package/app/components/main/connections/Deps.vue +34 -0
  139. package/app/components/main/connections/Externals.vue +46 -0
  140. package/app/components/main/connections/MainConnections.vue +41 -0
  141. package/app/components/main/connections/MainConnectionsButton.vue +80 -0
  142. package/app/components/main/connections/ScrollPane.vue +11 -0
  143. package/app/components/main/contentStats/Item.vue +35 -0
  144. package/app/components/main/contentStats/ItemElement.vue +19 -0
  145. package/app/components/main/contentStats/ItemMaterials.vue +11 -0
  146. package/app/components/main/contentStats/MainContentStats.vue +50 -0
  147. package/app/components/preview/Preview.vue +173 -186
  148. package/app/components/preview/PreviewError.vue +10 -0
  149. package/app/components/preview/PreviewLoading.vue +5 -14
  150. package/app/components/preview/PreviewScreen.vue +65 -141
  151. package/app/components/preview/PreviewScreenButton.vue +39 -0
  152. package/app/components/preview/screen/ContentPage.vue +50 -0
  153. package/app/components/preview/screen/DirectLink.vue +23 -0
  154. package/app/components/preview/screen/Unique.vue +54 -0
  155. package/app/components/site/SiteAside.vue +70 -0
  156. package/app/components/site/SiteAsideOverlay.vue +21 -0
  157. package/app/components/site/SiteMain.vue +16 -0
  158. package/app/components/transition/Fade.vue +30 -19
  159. package/app/components/transition/Slide.vue +47 -0
  160. package/app/components/tree/TreeContainer.vue +5 -11
  161. package/app/components/tree/TreeItem.vue +40 -89
  162. package/app/composables/ads.ts +23 -0
  163. package/app/composables/analytics.ts +102 -0
  164. package/app/composables/appElements.ts +40 -0
  165. package/app/composables/aside.ts +28 -0
  166. package/app/composables/asideMajorPane.ts +135 -0
  167. package/app/composables/asideMinor.ts +109 -0
  168. package/app/composables/contentNav.ts +7 -0
  169. package/app/composables/favicon.ts +104 -4
  170. package/app/composables/file.ts +3 -0
  171. package/app/composables/formatText.ts +85 -71
  172. package/app/composables/loading.ts +2 -0
  173. package/app/composables/mainContent.ts +31 -0
  174. package/app/composables/og.ts +165 -0
  175. package/app/composables/phrases.ts +126 -81
  176. package/app/composables/preview.ts +53 -0
  177. package/app/composables/route.ts +4 -0
  178. package/app/composables/theme.ts +71 -29
  179. package/app/composables/url.ts +22 -33
  180. package/app/formatters/ru.ts +14 -0
  181. package/app/pages/article/[...articleId].vue +10 -1
  182. package/app/pages/book/[...bookId].vue +52 -43
  183. package/app/pages/contributor/[contributorId].vue +151 -0
  184. package/app/pages/contributors.vue +99 -0
  185. package/app/pages/group/[...groupId].vue +53 -59
  186. package/app/pages/index.vue +114 -26
  187. package/app/pages/page/[...pageId].vue +60 -0
  188. package/app/pages/practice/[...practiceId].vue +12 -0
  189. package/app/pages/sponsors.vue +91 -0
  190. package/app/pages/summary/[...summaryId].vue +10 -1
  191. package/app/plugins/appSetup/client/htmlBranding.ts +6 -0
  192. package/app/plugins/appSetup/client/welcome.ts +35 -0
  193. package/app/plugins/appSetup/config.ts +6 -0
  194. package/app/plugins/appSetup/global.ts +3 -0
  195. package/app/plugins/appSetup/index.ts +28 -0
  196. package/app/plugins/prerender.server.ts +40 -0
  197. package/app/router.options.ts +5 -0
  198. package/app/scripts/theme.js +33 -0
  199. package/app/styles/main.css +173 -0
  200. package/bin/erudit.mjs +2 -2
  201. package/modules/erudit/globals/content.ts +4 -0
  202. package/modules/erudit/globals/contributor.ts +1 -0
  203. package/modules/erudit/globals/eruditConfig.ts +10 -0
  204. package/modules/erudit/globals/problem.ts +1 -0
  205. package/modules/erudit/globals/prose.ts +1 -0
  206. package/modules/erudit/globals/public.ts +18 -0
  207. package/modules/erudit/index.ts +60 -0
  208. package/{module → modules/erudit}/logger.ts +2 -2
  209. package/modules/erudit/setup/aliases.ts +17 -0
  210. package/modules/erudit/setup/baseUrl.ts +19 -0
  211. package/modules/erudit/setup/elements/appTemplate.ts +45 -0
  212. package/modules/erudit/setup/elements/globalTemplate.ts +82 -0
  213. package/modules/erudit/setup/elements/globalTypes.ts +273 -0
  214. package/modules/erudit/setup/elements/setup.ts +167 -0
  215. package/modules/erudit/setup/elements/shared.ts +10 -0
  216. package/modules/erudit/setup/elements/tagsTable.ts +28 -0
  217. package/modules/erudit/setup/fullRestart.ts +71 -0
  218. package/modules/erudit/setup/globals.ts +196 -0
  219. package/modules/erudit/setup/nuxtConfig.ts +62 -0
  220. package/modules/erudit/setup/projectConfig.ts +114 -0
  221. package/modules/erudit/setup/publicAssets.ts +52 -0
  222. package/modules/erudit/setup/runtimeConfig.ts +58 -0
  223. package/modules/erudit/watcher.ts +27 -0
  224. package/nuxt.config.ts +66 -87
  225. package/package.json +38 -19
  226. package/proxy/prose.app.ts +1 -0
  227. package/proxy/prose.ts +1 -0
  228. package/public/favicons/default.svg +1 -0
  229. package/{app/public → public}/logotype.svg +1 -1
  230. package/public/og.png +0 -0
  231. package/server/api/aside/major/frontNav/book/[...shortId].ts +10 -0
  232. package/server/api/aside/major/frontNav/global.ts +5 -0
  233. package/server/api/aside/major/pages.ts +6 -0
  234. package/server/api/contributor/list.ts +61 -0
  235. package/server/api/contributor/page/[contributorId].ts +68 -0
  236. package/server/api/indexPage.ts +81 -0
  237. package/server/api/language/functions.ts +6 -7
  238. package/server/api/language/phrase/[phraseKey].ts +32 -0
  239. package/server/api/main/content/[...contentTypePath].ts +153 -0
  240. package/server/api/news/batch/[batchIndex].ts +5 -0
  241. package/server/api/pageSponsors.ts +58 -0
  242. package/server/api/prerender/content.ts +82 -0
  243. package/server/api/prerender/default.ts +35 -0
  244. package/server/api/prerender/files.ts +10 -0
  245. package/server/api/prerender/frontNav.ts +13 -0
  246. package/server/api/prerender/language.ts +7 -0
  247. package/server/api/prerender/news.ts +8 -0
  248. package/server/api/prerender/quotes.ts +15 -0
  249. package/server/api/preview/contentPage/[...contentTypePath].ts +63 -0
  250. package/server/api/preview/contentUnique/[...contentTypePathUnique].ts +81 -0
  251. package/server/api/problemScript/[...problemScriptPath].ts +92 -0
  252. package/server/api/quote/data/[quoteId].ts +87 -0
  253. package/server/api/quote/ids.ts +3 -0
  254. package/server/erudit/build.ts +137 -0
  255. package/server/erudit/cameos/build.ts +111 -0
  256. package/server/erudit/config.ts +13 -0
  257. package/server/erudit/content/global/build.ts +271 -0
  258. package/server/erudit/content/global/singleton.ts +5 -0
  259. package/server/erudit/content/nav/build.ts +431 -0
  260. package/server/erudit/content/nav/front.ts +127 -0
  261. package/server/erudit/content/nav/repository/books.ts +40 -0
  262. package/server/erudit/content/nav/repository/get.ts +33 -0
  263. package/server/erudit/content/nav/repository/hasChildren.ts +5 -0
  264. package/server/erudit/content/nav/repository/hasNav.ts +3 -0
  265. package/server/erudit/content/nav/repository/hasParent.ts +5 -0
  266. package/server/erudit/content/nav/repository/id.ts +9 -0
  267. package/server/erudit/content/nav/repository/index.ts +9 -0
  268. package/server/erudit/content/nav/repository/order.ts +14 -0
  269. package/server/erudit/content/nav/repository/previousNext.ts +35 -0
  270. package/server/erudit/content/nav/repository/walk.ts +127 -0
  271. package/server/erudit/content/nav/setup.ts +13 -0
  272. package/server/erudit/content/nav/types.ts +24 -0
  273. package/server/erudit/content/repository/breadcrumbs.ts +24 -0
  274. package/server/erudit/content/repository/children.ts +47 -0
  275. package/server/erudit/content/repository/connections.ts +35 -0
  276. package/server/erudit/content/repository/contentLink.ts +16 -0
  277. package/server/erudit/content/repository/decoration.ts +23 -0
  278. package/server/erudit/content/repository/deps.ts +84 -0
  279. package/server/erudit/content/repository/description.ts +11 -0
  280. package/server/erudit/content/repository/elementSnippets.ts +65 -0
  281. package/server/erudit/content/repository/externals.ts +21 -0
  282. package/server/erudit/content/repository/flags.ts +33 -0
  283. package/server/erudit/content/repository/seo.ts +12 -0
  284. package/server/erudit/content/repository/stats.ts +97 -0
  285. package/server/erudit/content/repository/title.ts +27 -0
  286. package/server/erudit/content/repository/topicParts.ts +39 -0
  287. package/server/erudit/content/repository/unique.ts +76 -0
  288. package/server/erudit/content/resolve/book.ts +32 -0
  289. package/server/erudit/content/resolve/group.ts +39 -0
  290. package/server/erudit/content/resolve/index.ts +139 -0
  291. package/server/erudit/content/resolve/page.ts +87 -0
  292. package/server/erudit/content/resolve/topic.ts +185 -0
  293. package/server/erudit/content/resolve/utils/contentError.ts +10 -0
  294. package/server/erudit/content/resolve/utils/insertContentItem.ts +122 -0
  295. package/server/erudit/content/resolve/utils/insertContentResolved.ts +93 -0
  296. package/server/erudit/content/search.ts +135 -0
  297. package/server/erudit/contributors/build.ts +111 -0
  298. package/server/erudit/contributors/global.ts +3 -0
  299. package/server/erudit/contributors/repository/avatarUrl.ts +10 -0
  300. package/server/erudit/contributors/repository/contributions.ts +178 -0
  301. package/server/erudit/contributors/repository/count.ts +3 -0
  302. package/server/erudit/contributors/search.ts +34 -0
  303. package/server/erudit/db/repository/pushFile.ts +23 -0
  304. package/server/erudit/db/repository/pushProblemScript.ts +19 -0
  305. package/server/erudit/db/repository/pushProseLink.ts +40 -0
  306. package/server/erudit/db/schema/cameos.ts +7 -0
  307. package/server/erudit/db/schema/content.ts +18 -0
  308. package/server/erudit/db/schema/contentContributions.ts +15 -0
  309. package/server/erudit/db/schema/contentDeps.ts +21 -0
  310. package/server/erudit/db/schema/contentElementStats.ts +20 -0
  311. package/server/erudit/db/schema/contentProseLinks.ts +23 -0
  312. package/server/erudit/db/schema/contentSnippets.ts +16 -0
  313. package/server/erudit/db/schema/contentToc.ts +16 -0
  314. package/server/erudit/db/schema/contentUniques.ts +25 -0
  315. package/server/erudit/db/schema/contributors.ts +12 -0
  316. package/server/erudit/db/schema/files.ts +11 -0
  317. package/server/erudit/db/schema/groups.ts +6 -0
  318. package/server/erudit/db/schema/index.ts +17 -0
  319. package/server/erudit/db/schema/news.ts +7 -0
  320. package/server/erudit/db/schema/pages.ts +7 -0
  321. package/server/erudit/db/schema/problemScripts.ts +14 -0
  322. package/server/erudit/db/schema/sponsors.ts +9 -0
  323. package/server/erudit/db/schema/topics.ts +9 -0
  324. package/server/erudit/db/setup.ts +62 -0
  325. package/server/erudit/db/types.ts +10 -0
  326. package/server/erudit/global.ts +33 -0
  327. package/server/erudit/importer.ts +97 -0
  328. package/server/erudit/index.ts +90 -0
  329. package/server/erudit/language/list/en.ts +209 -0
  330. package/server/erudit/language/list/ru.ts +214 -0
  331. package/server/erudit/language/list.ts +6 -0
  332. package/server/erudit/language/setup.ts +36 -0
  333. package/server/erudit/language/types.ts +16 -0
  334. package/server/erudit/logger.ts +77 -0
  335. package/server/erudit/news/build.ts +77 -0
  336. package/server/erudit/news/repository/batch.ts +61 -0
  337. package/server/erudit/prose/repository/finalize.ts +68 -0
  338. package/server/erudit/prose/repository/get.ts +54 -0
  339. package/server/erudit/prose/repository/resolve.ts +17 -0
  340. package/server/erudit/prose/storage/callout.ts +14 -0
  341. package/server/erudit/prose/storage/image.ts +20 -0
  342. package/server/erudit/prose/storage/link.ts +226 -0
  343. package/server/erudit/prose/storage/problemScript.ts +21 -0
  344. package/server/erudit/prose/storage/video.ts +14 -0
  345. package/server/erudit/prose/transform/bundleProblemScript.ts +6 -0
  346. package/server/erudit/prose/transform/extensions.ts +15 -0
  347. package/server/erudit/quote/repository/ids.ts +31 -0
  348. package/server/erudit/repository.ts +96 -0
  349. package/server/erudit/sponsors/build.ts +114 -0
  350. package/server/erudit/sponsors/repository/avatarUrl.ts +10 -0
  351. package/server/erudit/sponsors/repository/count.ts +4 -0
  352. package/server/erudit/staticFile.ts +28 -0
  353. package/server/plugins/augmentCss.ts +17 -0
  354. package/server/plugins/lang.ts +7 -0
  355. package/server/plugins/metaViewport.ts +15 -0
  356. package/server/plugins/theme.ts +13 -0
  357. package/server/routes/file/[...path].ts +18 -0
  358. package/server/routes/robots.txt.ts +9 -0
  359. package/server/routes/search.json.gz.ts +73 -0
  360. package/server/routes/sitemap.xml.ts +81 -0
  361. package/shared/search/encoders.ts +20 -0
  362. package/shared/types/asideMajorPages.ts +4 -0
  363. package/shared/types/breadcrumbs.ts +9 -0
  364. package/shared/types/contentChildren.ts +10 -0
  365. package/shared/types/contentConnections.ts +27 -0
  366. package/shared/types/contentStats.ts +6 -0
  367. package/shared/types/elementSnippet.ts +8 -0
  368. package/shared/types/frontContentNav.ts +38 -0
  369. package/shared/types/indexPage.ts +20 -0
  370. package/shared/types/language.ts +189 -75
  371. package/shared/types/mainContent.ts +69 -0
  372. package/shared/types/news.ts +13 -0
  373. package/shared/types/preview.ts +28 -0
  374. package/shared/types/runtimeConfig.ts +64 -0
  375. package/shared/types/search.ts +79 -0
  376. package/shared/utils/contentTypePath.ts +63 -0
  377. package/shared/utils/icons.ts +11 -0
  378. package/shared/utils/pages.ts +24 -0
  379. package/shared/utils/slasher.ts +64 -0
  380. package/shared/utils/stringColor.ts +13 -9
  381. package/shared/utils/toStringEqual.ts +21 -0
  382. package/shared/utils/zip.ts +64 -0
  383. package/test/shared/utils/slasher.test.ts +75 -0
  384. package/test/shared/utils/zip.test.ts +8 -0
  385. package/tsconfig.json +17 -8
  386. package/app/assets/icons/alert.svg +0 -3
  387. package/app/assets/icons/angle-right.svg +0 -3
  388. package/app/assets/icons/arrow-in-text.svg +0 -3
  389. package/app/assets/icons/arrow-left.svg +0 -3
  390. package/app/assets/icons/arrow-up-to-right.svg +0 -3
  391. package/app/assets/icons/chip.svg +0 -3
  392. package/app/assets/icons/circle-help.svg +0 -3
  393. package/app/assets/icons/cross.svg +0 -3
  394. package/app/assets/icons/ellipsis-vertical.svg +0 -3
  395. package/app/assets/icons/file-check.svg +0 -3
  396. package/app/assets/icons/file-star.svg +0 -3
  397. package/app/assets/icons/link-external.svg +0 -3
  398. package/app/assets/icons/link.svg +0 -3
  399. package/app/assets/icons/outline/book.svg +0 -3
  400. package/app/assets/icons/outline/file-lines.svg +0 -3
  401. package/app/assets/icons/pirate.svg +0 -3
  402. package/app/assets/icons/search.svg +0 -3
  403. package/app/assets/icons/shuffle.svg +0 -3
  404. package/app/assets/icons/star.svg +0 -3
  405. package/app/components/Loading.vue +0 -23
  406. package/app/components/SiteAside.vue +0 -393
  407. package/app/components/SiteMain.vue +0 -34
  408. package/app/components/ads/BannerTemplate.vue +0 -51
  409. package/app/components/ads/BottomBanner.vue +0 -45
  410. package/app/components/ads/LeftBanner.vue +0 -50
  411. package/app/components/aside/major/PaneContentScroll.vue +0 -23
  412. package/app/components/aside/major/PaneSwitch.vue +0 -54
  413. package/app/components/aside/major/PaneSwitchButton.vue +0 -63
  414. package/app/components/aside/major/panes/Language.vue +0 -79
  415. package/app/components/aside/major/panes/Pages.vue +0 -34
  416. package/app/components/aside/major/panes/Search.vue +0 -11
  417. package/app/components/aside/major/panes/nav/Nav.vue +0 -87
  418. package/app/components/aside/major/panes/nav/NavBook.vue +0 -87
  419. package/app/components/aside/major/panes/nav/NavBookLoading.vue +0 -24
  420. package/app/components/aside/major/panes/nav/NavGlobal.vue +0 -16
  421. package/app/components/aside/major/panes/nav/fnav/FNav.vue +0 -105
  422. package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +0 -32
  423. package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +0 -40
  424. package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +0 -60
  425. package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +0 -34
  426. package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +0 -80
  427. package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +0 -24
  428. package/app/components/aside/major/panes/other/ItemContent.vue +0 -29
  429. package/app/components/aside/major/panes/other/ItemGenerator.vue +0 -15
  430. package/app/components/aside/major/panes/other/ItemTheme.vue +0 -54
  431. package/app/components/aside/major/panes/other/Other.vue +0 -16
  432. package/app/components/aside/minor/AsideMinorContributor.vue +0 -5
  433. package/app/components/aside/minor/AsideMinorNews.vue +0 -11
  434. package/app/components/aside/minor/AsideMinorTopLink.vue +0 -67
  435. package/app/components/aside/minor/Contribute.vue +0 -145
  436. package/app/components/aside/minor/content/AsideMinorContent.vue +0 -92
  437. package/app/components/aside/minor/topic/AsideMinorTopic.vue +0 -32
  438. package/app/components/aside/minor/topic/TopicContributors.vue +0 -177
  439. package/app/components/aside/minor/topic/TopicNav.vue +0 -49
  440. package/app/components/aside/minor/topic/TopicToc.vue +0 -219
  441. package/app/components/aside/minor/topic/TopicTocItem.vue +0 -30
  442. package/app/components/aside/utils/AsideOverlayPane.vue +0 -40
  443. package/app/components/bitran/BitranContent.vue +0 -77
  444. package/app/components/bitran/RenderWrapper.vue +0 -10
  445. package/app/components/contributor/ContributorAvatar.vue +0 -43
  446. package/app/components/contributor/ContributorListItem.vue +0 -35
  447. package/app/components/main/topic/MainTopic.vue +0 -78
  448. package/app/components/main/topic/TopicPartSwitch.vue +0 -118
  449. package/app/components/main/utils/Breadcrumb.vue +0 -70
  450. package/app/components/main/utils/ContentDecoration.vue +0 -29
  451. package/app/components/main/utils/ContentDescription.vue +0 -19
  452. package/app/components/main/utils/ContentPopover.vue +0 -188
  453. package/app/components/main/utils/ContentPopovers.vue +0 -111
  454. package/app/components/main/utils/ContentReferences.vue +0 -70
  455. package/app/components/main/utils/ContentSection.vue +0 -45
  456. package/app/components/main/utils/ContentTitle.vue +0 -63
  457. package/app/components/main/utils/reference/ReferenceGroup.vue +0 -38
  458. package/app/components/main/utils/reference/ReferenceItem.vue +0 -68
  459. package/app/components/main/utils/reference/ReferenceSource.vue +0 -116
  460. package/app/components/preview/PreviewDisplay.vue +0 -139
  461. package/app/components/preview/PreviewFooterAction.vue +0 -73
  462. package/app/components/preview/display/Alert.vue +0 -50
  463. package/app/components/preview/display/Custom.vue +0 -18
  464. package/app/components/preview/display/GenericLink.vue +0 -48
  465. package/app/components/preview/display/PageLink.vue +0 -20
  466. package/app/components/preview/display/Unique.vue +0 -55
  467. package/app/composables/bitran.ts +0 -105
  468. package/app/composables/bitranContent.ts +0 -51
  469. package/app/composables/bitranLocation.ts +0 -7
  470. package/app/composables/contentData.ts +0 -36
  471. package/app/composables/contentPage.ts +0 -157
  472. package/app/composables/contentRoute.ts +0 -45
  473. package/app/composables/darkMagic.ts +0 -24
  474. package/app/composables/externalApi.ts +0 -63
  475. package/app/composables/majorPane.ts +0 -60
  476. package/app/pages/_test/preview.vue +0 -110
  477. package/app/pages/members.vue +0 -6
  478. package/app/pages/practice/[...practice].vue +0 -3
  479. package/app/public/favicon/article.svg +0 -10
  480. package/app/public/favicon/default.svg +0 -10
  481. package/app/public/favicon/practice.svg +0 -10
  482. package/app/public/favicon/summary.svg +0 -10
  483. package/app/public/og-default.png +0 -0
  484. package/app/public/user.svg +0 -10
  485. package/app/scripts/_immediate.js +0 -9
  486. package/app/scripts/aside/index.ts +0 -59
  487. package/app/scripts/aside/major/nav.ts +0 -26
  488. package/app/scripts/aside/minor/state.ts +0 -37
  489. package/app/scripts/aside/minor/topic.ts +0 -3
  490. package/app/scripts/flag.ts +0 -28
  491. package/app/scripts/og.ts +0 -27
  492. package/app/scripts/preview/build.ts +0 -73
  493. package/app/scripts/preview/data/alert.ts +0 -19
  494. package/app/scripts/preview/data/custom.ts +0 -8
  495. package/app/scripts/preview/data/genericLink.ts +0 -24
  496. package/app/scripts/preview/data/pageLink.ts +0 -22
  497. package/app/scripts/preview/data/unique.ts +0 -72
  498. package/app/scripts/preview/data.ts +0 -24
  499. package/app/scripts/preview/display.ts +0 -37
  500. package/app/scripts/preview/footer.ts +0 -9
  501. package/app/scripts/preview/request.ts +0 -51
  502. package/app/scripts/preview/state.ts +0 -63
  503. package/app/styles/_immediate.css +0 -7
  504. package/app/styles/_util.scss +0 -43
  505. package/app/styles/_utils.scss +0 -44
  506. package/app/styles/app.scss +0 -91
  507. package/app/styles/def/_bp.scss +0 -27
  508. package/app/styles/def/_size.scss +0 -7
  509. package/app/styles/def/_z.scss +0 -5
  510. package/app/styles/normalize.scss +0 -63
  511. package/app/styles/partials/_darkMagic.scss +0 -5
  512. package/app/styles/partials/_fnav.scss +0 -15
  513. package/app/styles/partials/_preview.scss +0 -5
  514. package/globalPath.ts +0 -21
  515. package/globals/bitran.ts +0 -2
  516. package/globals/content.ts +0 -22
  517. package/globals/contributor.ts +0 -5
  518. package/globals/erudit.ts +0 -5
  519. package/globals/register.ts +0 -18
  520. package/languages/en.ts +0 -95
  521. package/languages/ru.ts +0 -99
  522. package/module/bitran.ts +0 -36
  523. package/module/config.ts +0 -35
  524. package/module/imports.ts +0 -50
  525. package/module/index.ts +0 -47
  526. package/module/paths.ts +0 -22
  527. package/module/restart.ts +0 -61
  528. package/server/api/aside/major/nav/bookIds.ts +0 -5
  529. package/server/api/aside/major/nav/bookNav/[...bookId].ts +0 -20
  530. package/server/api/aside/major/nav/global.ts +0 -7
  531. package/server/api/aside/minor/news.ts +0 -7
  532. package/server/api/aside/minor/path.ts +0 -77
  533. package/server/api/bitran/content/[location].ts +0 -8
  534. package/server/api/bitran/toc/[location].ts +0 -7
  535. package/server/api/content/data.ts +0 -72
  536. package/server/api/contributor/count.ts +0 -6
  537. package/server/api/fake/content.ts +0 -11
  538. package/server/api/fake/shared/languages.ts +0 -12
  539. package/server/api/language/phrase/[phraseId].ts +0 -19
  540. package/server/api/language/phraseIds.ts +0 -8
  541. package/server/api/preview/page/[...parts].ts +0 -52
  542. package/server/api/preview/unique/[location].ts +0 -60
  543. package/server/plugin/bitran/content.ts +0 -194
  544. package/server/plugin/bitran/location.ts +0 -25
  545. package/server/plugin/bitran/products/include.ts +0 -228
  546. package/server/plugin/bitran/products/link.ts +0 -116
  547. package/server/plugin/bitran/setup.ts +0 -11
  548. package/server/plugin/bitran/toc.ts +0 -75
  549. package/server/plugin/bitran/transpiler.ts +0 -30
  550. package/server/plugin/build/close.ts +0 -10
  551. package/server/plugin/build/jobs/content/builderArgs.ts +0 -8
  552. package/server/plugin/build/jobs/content/generic.ts +0 -176
  553. package/server/plugin/build/jobs/content/parse.ts +0 -109
  554. package/server/plugin/build/jobs/content/path.ts +0 -6
  555. package/server/plugin/build/jobs/content/type/book.ts +0 -9
  556. package/server/plugin/build/jobs/content/type/group.ts +0 -37
  557. package/server/plugin/build/jobs/content/type/topic.ts +0 -36
  558. package/server/plugin/build/jobs/contributors.ts +0 -66
  559. package/server/plugin/build/jobs/language.ts +0 -36
  560. package/server/plugin/build/jobs/nav.ts +0 -214
  561. package/server/plugin/build/process.ts +0 -25
  562. package/server/plugin/build/rebuild.ts +0 -55
  563. package/server/plugin/build/setup.ts +0 -22
  564. package/server/plugin/content/absoluteId.ts +0 -94
  565. package/server/plugin/content/context.ts +0 -116
  566. package/server/plugin/db/entities/Book.ts +0 -7
  567. package/server/plugin/db/entities/Content.ts +0 -49
  568. package/server/plugin/db/entities/Contribution.ts +0 -10
  569. package/server/plugin/db/entities/Contributor.ts +0 -16
  570. package/server/plugin/db/entities/Group.ts +0 -14
  571. package/server/plugin/db/entities/Hash.ts +0 -15
  572. package/server/plugin/db/entities/Topic.ts +0 -20
  573. package/server/plugin/db/entities/Unique.ts +0 -21
  574. package/server/plugin/db/setup.ts +0 -34
  575. package/server/plugin/global.ts +0 -17
  576. package/server/plugin/importer.ts +0 -12
  577. package/server/plugin/index.ts +0 -9
  578. package/server/plugin/logger.ts +0 -23
  579. package/server/plugin/nav/node.ts +0 -26
  580. package/server/plugin/nav/utils.ts +0 -129
  581. package/server/plugin/repository/book.ts +0 -21
  582. package/server/plugin/repository/content.ts +0 -238
  583. package/server/plugin/repository/contributor.ts +0 -8
  584. package/server/plugin/repository/frontNav.ts +0 -148
  585. package/server/plugin/repository/topic.ts +0 -32
  586. package/server/tsconfig.json +0 -9
  587. package/shared/aside/minor.ts +0 -51
  588. package/shared/asset.ts +0 -15
  589. package/shared/bitran/stringContent.ts +0 -6
  590. package/shared/bitran/toc.ts +0 -8
  591. package/shared/content/context.ts +0 -9
  592. package/shared/content/data/base.ts +0 -32
  593. package/shared/content/data/index.ts +0 -5
  594. package/shared/content/data/type/book.ts +0 -5
  595. package/shared/content/data/type/group.ts +0 -6
  596. package/shared/content/data/type/topic.ts +0 -11
  597. package/shared/content/previousNext.ts +0 -9
  598. package/shared/contributor.ts +0 -5
  599. package/shared/frontNav.ts +0 -41
  600. package/shared/icons.ts +0 -38
  601. package/shared/image.ts +0 -5
  602. package/shared/link.ts +0 -28
  603. package/shared/popover.ts +0 -8
  604. package/shared/utils/objectsEqual.ts +0 -4
  605. package/utils/stress.ts +0 -9
@@ -1,94 +0,0 @@
1
- import { isTopicPart } from '@erudit-js/cog/schema';
2
-
3
- import {
4
- parseBitranLocation,
5
- stringifyBitranLocation,
6
- type BitranLocation,
7
- } from '@erudit-js/cog/schema';
8
- import { getNavBookOf } from '../nav/utils';
9
-
10
- export function toAbsoluteContentLocation<T extends string | BitranLocation>(
11
- location: T,
12
- contextContentId: string,
13
- ): T {
14
- const isLocationStr = typeof location === 'string';
15
- const parsedLocation = isLocationStr
16
- ? parseBitranLocation(location)
17
- : (location as BitranLocation);
18
-
19
- if (
20
- isTopicPart(parsedLocation.type) ||
21
- ['book', 'group', 'topic'].includes(parsedLocation.type)
22
- ) {
23
- parsedLocation.path = toAbsoluteContentId(
24
- parsedLocation.path!,
25
- contextContentId,
26
- );
27
- return (
28
- isLocationStr
29
- ? stringifyBitranLocation(parsedLocation)
30
- : parsedLocation
31
- ) as T;
32
- }
33
-
34
- return location;
35
- }
36
-
37
- export function toAbsoluteContentId(
38
- path: string,
39
- contextContentId: string = '',
40
- ) {
41
- const fullPath = (() => {
42
- if (path.startsWith('..'))
43
- return (contextContentId ? contextContentId + '/' : '') + path;
44
-
45
- if (path.startsWith('.'))
46
- return trimEdgeSlashes(contextContentId + path.substring(1));
47
-
48
- if (path.startsWith('~'))
49
- return trimEdgeSlashes(
50
- tryGetParentBook(contextContentId) + path.substring(1),
51
- );
52
-
53
- return path;
54
- })();
55
-
56
- const reversePathParts = fullPath.split('/').reverse();
57
- const finalParts: string[] = [];
58
-
59
- let skipCounter = 0;
60
-
61
- for (let i = 0; i < reversePathParts.length; i++) {
62
- const part = reversePathParts[i];
63
-
64
- if (part === '..') {
65
- skipCounter++;
66
- continue;
67
- }
68
-
69
- if (skipCounter) {
70
- skipCounter--;
71
- continue;
72
- }
73
-
74
- finalParts.unshift(part!);
75
- }
76
-
77
- return finalParts.join('/');
78
- }
79
-
80
- function trimEdgeSlashes(path: string) {
81
- if (path.startsWith('/')) path = path.substring(1);
82
-
83
- if (path.endsWith('/')) path = path.substring(0, path.length - 1);
84
-
85
- return path;
86
- }
87
-
88
- function tryGetParentBook(contentId: string): string {
89
- const navBook = getNavBookOf(contentId);
90
-
91
- if (!navBook) return '';
92
-
93
- return navBook.id;
94
- }
@@ -1,116 +0,0 @@
1
- import {
2
- isContentType,
3
- isTopicPart,
4
- type BitranLocation,
5
- type TopicPart,
6
- } from '@erudit-js/cog/schema';
7
-
8
- import { ERUDIT_SERVER } from '@server/global';
9
- import { getIdsUp, isSkipId } from '@server/nav/utils';
10
- import { DbContent } from '@server/db/entities/Content';
11
- import { DbContributor } from '@server/db/entities/Contributor';
12
-
13
- import type { Context } from '@shared/content/context';
14
- import {
15
- createContentLink,
16
- createContributorLink,
17
- createTopicPartLink,
18
- } from '@shared/link';
19
- import { CONTENT_TYPE_ICON, ICON, TOPIC_PART_ICON } from '@erudit/shared/icons';
20
-
21
- export async function getContentContext(contentId: string): Promise<Context> {
22
- const context: Context = [];
23
-
24
- for (const _contentId of (await getIdsUp(contentId)).reverse()) {
25
- const dbContent = await getDbContent(_contentId);
26
-
27
- context.push({
28
- type: ERUDIT_SERVER.LANGUAGE.phrases[dbContent.type],
29
- icon: isTopicPart(dbContent.type)
30
- ? TOPIC_PART_ICON[dbContent.type]
31
- : isContentType(dbContent.type)
32
- ? CONTENT_TYPE_ICON[dbContent.type]
33
- : '',
34
- title: dbContent.title || dbContent.contentId,
35
- href: createContentLink(dbContent.type, dbContent.contentId),
36
- hidden: await isSkipId(dbContent.contentId),
37
- });
38
- }
39
-
40
- return context;
41
- }
42
-
43
- export async function getTopicPartContext(
44
- topicPart: TopicPart,
45
- contentId: string,
46
- ): Promise<Context> {
47
- const context = await getContentContext(contentId);
48
- const topicItem = context.pop()!;
49
-
50
- topicItem.type = ERUDIT_SERVER.LANGUAGE.phrases[topicPart];
51
- topicItem.icon = TOPIC_PART_ICON[topicPart];
52
- topicItem.href = createTopicPartLink(topicPart, contentId);
53
-
54
- return context.concat([topicItem]);
55
- }
56
-
57
- export async function getContributorContext(
58
- contributorId: string,
59
- ): Promise<Context> {
60
- const dbContributor = await ERUDIT_SERVER.DB.manager.findOne(
61
- DbContributor,
62
- {
63
- select: ['displayName'],
64
- where: { contributorId },
65
- },
66
- );
67
-
68
- if (!dbContributor)
69
- throw new Error(`Contributor "${contributorId}" not found!`);
70
-
71
- return [
72
- {
73
- type: ERUDIT_SERVER.LANGUAGE.phrases.contributor,
74
- icon: ICON.contributor,
75
- title: dbContributor.displayName || contributorId,
76
- href: createContributorLink(contributorId),
77
- hidden: false,
78
- },
79
- ];
80
- }
81
-
82
- export async function getLocationContext(
83
- location: BitranLocation,
84
- ): Promise<Context> {
85
- const contentId = location.path!;
86
-
87
- switch (location.type) {
88
- case 'article':
89
- case 'summary':
90
- case 'practice':
91
- return await getTopicPartContext(location.type, contentId);
92
- case 'group':
93
- return await getContentContext(contentId);
94
- case 'contributor':
95
- return await getContributorContext(contentId);
96
- }
97
-
98
- throw new Error(
99
- `Cant' build context for location unknown type "${location.type}"!`,
100
- );
101
- }
102
-
103
- //
104
- //
105
- //
106
-
107
- async function getDbContent(contentId: string): Promise<DbContent> {
108
- const dbContent = await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
109
- select: ['type', 'title', 'fullId', 'contentId'],
110
- where: { contentId },
111
- });
112
-
113
- if (!dbContent) throw new Error(`Content "${contentId}" not found!`);
114
-
115
- return dbContent;
116
- }
@@ -1,7 +0,0 @@
1
- import { Entity, PrimaryColumn } from 'typeorm';
2
-
3
- @Entity('book')
4
- export class DbBook {
5
- @PrimaryColumn('varchar')
6
- contentId!: string;
7
- }
@@ -1,49 +0,0 @@
1
- import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
2
- import type {
3
- ContentFlag,
4
- ContentReferences,
5
- ContentSeo,
6
- ContentType,
7
- } from '@erudit-js/cog/schema';
8
-
9
- import type { ImageData } from '@erudit/shared/image';
10
-
11
- @Entity('content')
12
- export class DbContent {
13
- @PrimaryColumn('varchar')
14
- contentId!: string;
15
-
16
- @Column('varchar')
17
- @Index({ unique: true })
18
- fullId!: string;
19
-
20
- @Column('varchar')
21
- type!: ContentType;
22
-
23
- @Column('varchar', { nullable: true })
24
- title?: string;
25
-
26
- @Column('varchar', { nullable: true })
27
- navTitle?: string;
28
-
29
- @Column('text', { nullable: true })
30
- description?: string;
31
-
32
- @Column('simple-json', { nullable: true })
33
- flags?: Partial<Record<ContentFlag, boolean>>;
34
-
35
- @Column('varchar', { nullable: true })
36
- decoration?: string;
37
-
38
- @Column('simple-json', { nullable: true })
39
- seo?: Partial<ContentSeo>;
40
-
41
- @Column('simple-json', { nullable: true })
42
- ogImage?: ImageData;
43
-
44
- @Column('simple-array', { nullable: true })
45
- dependencies?: string[];
46
-
47
- @Column('simple-json', { nullable: true })
48
- references?: ContentReferences;
49
- }
@@ -1,10 +0,0 @@
1
- import { Entity, PrimaryColumn } from 'typeorm';
2
-
3
- @Entity('contribution')
4
- export class DbContribution {
5
- @PrimaryColumn('varchar')
6
- contentId!: string;
7
-
8
- @PrimaryColumn('varchar')
9
- contributorId!: string;
10
- }
@@ -1,16 +0,0 @@
1
- import { Column, Entity, PrimaryColumn } from 'typeorm';
2
-
3
- @Entity('contributor')
4
- export class DbContributor {
5
- @PrimaryColumn('varchar')
6
- contributorId!: string;
7
-
8
- @Column('varchar', { nullable: true })
9
- displayName?: string;
10
-
11
- @Column('text', { nullable: true })
12
- description?: string;
13
-
14
- @Column('varchar', { nullable: true })
15
- avatar?: string;
16
- }
@@ -1,14 +0,0 @@
1
- import { Column, Entity, PrimaryColumn } from 'typeorm';
2
- import type { GroupType } from '@erudit-js/cog/schema';
3
-
4
- @Entity('group')
5
- export class DbGroup {
6
- @PrimaryColumn('varchar')
7
- contentId!: string;
8
-
9
- @Column('varchar')
10
- type!: GroupType;
11
-
12
- @Column('text', { nullable: true })
13
- content?: string;
14
- }
@@ -1,15 +0,0 @@
1
- import { Column, Entity, PrimaryColumn } from 'typeorm';
2
-
3
- /**
4
- * TODO:
5
- * Create hash of Bitran content of content items and use it to distinguish between content item version.
6
- */
7
-
8
- @Entity('hash')
9
- export class DbHash {
10
- @PrimaryColumn('varchar')
11
- id!: string;
12
-
13
- @Column('varchar')
14
- hash!: string;
15
- }
@@ -1,20 +0,0 @@
1
- import { Column, Entity, PrimaryColumn } from 'typeorm';
2
- import type { TopicPart } from '@erudit-js/cog/schema';
3
-
4
- @Entity('topic')
5
- export class DbTopic {
6
- @PrimaryColumn('varchar')
7
- contentId!: string;
8
-
9
- @Column('simple-array')
10
- parts!: TopicPart[];
11
-
12
- @Column('text', { nullable: true })
13
- article?: string;
14
-
15
- @Column('text', { nullable: true })
16
- summary?: string;
17
-
18
- @Column('text', { nullable: true })
19
- practice?: string;
20
- }
@@ -1,21 +0,0 @@
1
- import { Column, Entity, PrimaryColumn } from 'typeorm';
2
-
3
- import type { BitranContext } from '@erudit/shared/bitran/context';
4
-
5
- @Entity('unique')
6
- export class DbUnique {
7
- @PrimaryColumn('varchar')
8
- location!: string;
9
-
10
- @Column('varchar')
11
- productName!: string;
12
-
13
- @Column('text')
14
- content!: string;
15
-
16
- @Column('simple-json')
17
- context!: BitranContext;
18
-
19
- @Column('varchar', { nullable: true })
20
- title?: string;
21
- }
@@ -1,34 +0,0 @@
1
- import { DataSource } from 'typeorm';
2
-
3
- import { PROJECT_DIR } from '#erudit/globalPaths';
4
- import { ERUDIT_SERVER } from '@server/global';
5
-
6
- // Database Entities
7
- import { DbContributor } from './entities/Contributor';
8
- import { DbBook } from './entities/Book';
9
- import { DbContent } from './entities/Content';
10
- import { DbContribution } from './entities/Contribution';
11
- import { DbGroup } from './entities/Group';
12
- import { DbHash } from './entities/Hash';
13
- import { DbTopic } from './entities/Topic';
14
- import { DbUnique } from './entities/Unique';
15
-
16
- export async function setupDatabase() {
17
- ERUDIT_SERVER.DB = new DataSource({
18
- type: 'sqlite',
19
- database: PROJECT_DIR + '/.erudit/data.sqlite',
20
- synchronize: true,
21
- entities: [
22
- DbBook,
23
- DbContent,
24
- DbContribution,
25
- DbContributor,
26
- DbGroup,
27
- DbHash,
28
- DbTopic,
29
- DbUnique,
30
- ],
31
- });
32
-
33
- await ERUDIT_SERVER.DB.initialize();
34
- }
@@ -1,17 +0,0 @@
1
- import type { DataSource } from 'typeorm';
2
- import type { EruditBitranConfig, EruditConfig } from '@erudit-js/cog/schema';
3
-
4
- import type { EruditPhrases } from '@shared/types/language';
5
- import type { NavNode, RootNavNode } from '@server/nav/node';
6
-
7
- interface EruditServer {
8
- BUILD_PROMISE: Promise<void>;
9
- CONFIG: Partial<EruditConfig>;
10
- LANGUAGE: { phrases: EruditPhrases; functions: Record<string, Function> };
11
- DB: DataSource;
12
- NAV?: RootNavNode;
13
- NAV_BOOKS?: Record<string, NavNode>;
14
- BITRAN_CONFIG?: Partial<EruditBitranConfig>;
15
- }
16
-
17
- export const ERUDIT_SERVER: EruditServer = {} as any;
@@ -1,12 +0,0 @@
1
- import { createJiti } from 'jiti';
2
- import { ERUDIT_DIR } from '#erudit/globalPaths';
3
-
4
- const jiti = createJiti(ERUDIT_DIR, {
5
- // Enable reimporting same files during process in development mode
6
- fsCache: !import.meta.dev,
7
- moduleCache: !import.meta.dev,
8
- });
9
-
10
- export async function IMPORT(...args: Parameters<typeof jiti.import>) {
11
- return jiti.import(...args) as Promise<any>;
12
- }
@@ -1,9 +0,0 @@
1
- import { ERUDIT_SERVER } from './global';
2
- import { build } from './build/process';
3
- import { close } from './build/close';
4
-
5
- export default defineNitroPlugin((_nitro) => {
6
- ERUDIT_SERVER.BUILD_PROMISE = build();
7
- _nitro.hooks.hook('request', async () => await ERUDIT_SERVER.BUILD_PROMISE);
8
- _nitro.hooks.hook('close', close);
9
- });
@@ -1,23 +0,0 @@
1
- import chalk from 'chalk';
2
- import { createConsola } from 'consola';
3
- import { brandColorTitle } from '@erudit-js/cog/utils/brandNode';
4
-
5
- import eruditConfig from '#erudit/config';
6
-
7
- // TODO: Consola has buggy behaviour when called inside Nitro
8
- // @see https://github.com/nitrojs/nitro/issues/3079
9
-
10
- export const logger = createConsola({
11
- defaults: {
12
- //tag: brandColorTitle + ' Server',
13
- message: chalk.gray(`[${brandColorTitle} Server]`),
14
- },
15
- });
16
-
17
- export const debug = createConsola({
18
- defaults: {
19
- //tag: brandColorTitle + ' Server Debug',
20
- message: chalk.gray(`[${brandColorTitle} Server Debug]`),
21
- level: eruditConfig?.debug?.log ? 3 : -999,
22
- },
23
- });
@@ -1,26 +0,0 @@
1
- import type { ContentType } from '@erudit-js/cog/schema';
2
-
3
- export interface NavNode {
4
- type: ContentType;
5
- path: string;
6
- id: string;
7
- fullId: string;
8
- skip: boolean;
9
- children?: NavNode[];
10
- parent?: NavNode | RootNavNode;
11
- }
12
-
13
- export interface RootNavNode {
14
- type: '#root';
15
- children?: NavNode[];
16
- }
17
-
18
- export function isRootNode(node: NavNode | RootNavNode) {
19
- return node?.type === '#root';
20
- }
21
-
22
- export function createRootNode(): RootNavNode {
23
- return {
24
- type: '#root',
25
- };
26
- }
@@ -1,129 +0,0 @@
1
- import { ERUDIT_SERVER } from '@server/global';
2
- import { isRootNode, type NavNode } from '@server/nav/node';
3
-
4
- export async function walkNav(
5
- step: (node: NavNode) => Promise<void | false>,
6
- from: NavNode | typeof ERUDIT_SERVER.NAV = ERUDIT_SERVER.NAV,
7
- ) {
8
- if (!from) return;
9
-
10
- const stepResult = isRootNode(from) ? true : await step(from);
11
-
12
- if (stepResult !== false)
13
- if (from.children)
14
- for (const child of from.children) await walkNav(step, child);
15
- }
16
-
17
- //
18
- //
19
- //
20
-
21
- export function getNavBookOf(target: string | NavNode): NavNode | undefined {
22
- const id = typeof target === 'string' ? target : target.id;
23
-
24
- if (!id || !ERUDIT_SERVER.NAV_BOOKS) return undefined;
25
-
26
- const idParts = id.split('/');
27
-
28
- while (idParts.length > 0) {
29
- const book = ERUDIT_SERVER.NAV_BOOKS[idParts.join('/')];
30
-
31
- if (book) return book;
32
-
33
- idParts.pop();
34
- }
35
-
36
- return undefined;
37
- }
38
-
39
- export async function getPreviousNextNav(contentId: string) {
40
- let previousNav: NavNode | undefined, nextNav: NavNode | undefined;
41
- let book: NavNode | undefined;
42
- let finish = false;
43
-
44
- await walkNav(async (navNode) => {
45
- if (navNode.id === contentId) {
46
- book = getNavBookOf(navNode);
47
- finish = true;
48
- return;
49
- }
50
-
51
- if (finish && !nextNav) {
52
- nextNav = navNode;
53
- return false;
54
- }
55
-
56
- if (!finish) previousNav = navNode;
57
- });
58
-
59
- if (book) {
60
- //
61
- // Can't lead out of current book (if givent content item is inside the book)
62
- //
63
-
64
- if (previousNav)
65
- if (getNavBookOf(previousNav)?.fullId !== book.fullId)
66
- previousNav = undefined;
67
-
68
- if (nextNav)
69
- if (getNavBookOf(nextNav)?.fullId !== book.fullId)
70
- nextNav = undefined;
71
- } else {
72
- //
73
- // If not inside the book and tries to lead inside a book, then force lead to book's about page
74
- //
75
-
76
- if (previousNav) previousNav = getNavBookOf(previousNav) || previousNav;
77
-
78
- if (nextNav) nextNav = getNavBookOf(nextNav) || nextNav;
79
- }
80
-
81
- return {
82
- previousNav,
83
- nextNav,
84
- };
85
- }
86
-
87
- export async function getNavNode(
88
- contentId: string,
89
- ): Promise<NavNode | undefined> {
90
- let navNode: NavNode | undefined;
91
-
92
- await walkNav(async (_navNode) => {
93
- if (_navNode.id === contentId) {
94
- navNode = _navNode;
95
- return false;
96
- }
97
- });
98
-
99
- return navNode;
100
- }
101
-
102
- export async function getIdsUp(contentId: string): Promise<string[]> {
103
- const startNavNode = await getNavNode(contentId);
104
-
105
- if (!startNavNode) return [];
106
-
107
- const ids: string[] = [];
108
-
109
- let currentNavNode: any = startNavNode;
110
- while (currentNavNode?.id) {
111
- ids.push(currentNavNode.id);
112
- currentNavNode = currentNavNode.parent;
113
- }
114
-
115
- return ids;
116
- }
117
-
118
- export async function isSkipId(contentId: string) {
119
- let hidden = false;
120
-
121
- await walkNav(async (navNode) => {
122
- if (navNode.id === contentId) {
123
- hidden = navNode.skip;
124
- return false;
125
- }
126
- });
127
-
128
- return hidden;
129
- }
@@ -1,21 +0,0 @@
1
- import { ERUDIT_SERVER } from '@server/global';
2
- import { getNavBookOf } from '@server/nav/utils';
3
- import { DbContent } from '@server/db/entities/Content';
4
-
5
- export async function getContentBookFor(contentId: string) {
6
- const navBook = getNavBookOf(contentId);
7
-
8
- if (!navBook) return undefined;
9
-
10
- const bookId = navBook.id;
11
-
12
- const dbContent = await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
13
- select: ['title'],
14
- where: { contentId: bookId },
15
- });
16
-
17
- return {
18
- contentId: bookId,
19
- title: dbContent?.title || bookId,
20
- };
21
- }