erudit 3.0.0-dev.23 → 3.0.0-dev.26
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.
- package/app/app.vue +25 -185
- package/app/assets/icons/array-check.svg +3 -0
- package/app/assets/icons/array-lines.svg +3 -0
- package/app/assets/icons/array-star.svg +3 -0
- package/app/assets/icons/arrow/from-circle.svg +3 -0
- package/app/assets/icons/arrow/left.svg +3 -0
- package/app/assets/icons/arrow/outward-box.svg +3 -0
- package/app/assets/icons/arrow/outward.svg +3 -0
- package/app/assets/icons/arrow/to-circle.svg +3 -0
- package/app/assets/icons/arrow/up-to-right.svg +3 -0
- package/app/assets/icons/aside-open.svg +2 -2
- package/app/assets/icons/asterisk.svg +2 -2
- package/app/assets/icons/bell.svg +3 -0
- package/app/assets/icons/book-outline.svg +3 -0
- package/app/assets/icons/book-question.svg +2 -2
- package/app/assets/icons/book.svg +2 -2
- package/app/assets/icons/box.svg +3 -0
- package/app/assets/icons/bug.svg +2 -2
- package/app/assets/icons/chevron-right.svg +3 -0
- package/app/assets/icons/cog.svg +3 -0
- package/app/assets/icons/construction.svg +2 -2
- package/app/assets/icons/diamond.svg +2 -2
- package/app/assets/icons/draw.svg +2 -2
- package/app/assets/icons/erudit.svg +3 -0
- package/app/assets/icons/file-lines.svg +2 -2
- package/app/assets/icons/files.svg +2 -4
- package/app/assets/icons/flame.svg +3 -0
- package/app/assets/icons/folder-open.svg +2 -2
- package/app/assets/icons/folder.svg +2 -2
- package/app/assets/icons/globe.svg +2 -2
- package/app/assets/icons/graduation.svg +2 -2
- package/app/assets/icons/handshake.svg +3 -0
- package/app/assets/icons/house.svg +2 -2
- package/app/assets/icons/lines.svg +3 -0
- package/app/assets/icons/moon.svg +2 -2
- package/app/assets/icons/plus-circle.svg +2 -2
- package/app/assets/icons/plus.svg +2 -2
- package/app/assets/icons/puzzle.svg +2 -2
- package/app/assets/icons/question-circle.svg +3 -0
- package/app/assets/icons/rocket.svg +3 -1
- package/app/assets/icons/search/check.svg +3 -0
- package/app/assets/icons/search/dead.svg +3 -0
- package/app/assets/icons/search/glass.svg +3 -0
- package/app/assets/icons/search/wtf.svg +3 -0
- package/app/assets/icons/sun-moon.svg +2 -2
- package/app/assets/icons/sun.svg +2 -2
- package/app/assets/icons/translate.svg +3 -0
- package/app/assets/icons/user.svg +2 -2
- package/app/assets/icons/users.svg +2 -2
- package/app/assets/icons/warning.svg +3 -0
- package/app/components/EruditLink.ts +9 -0
- package/app/components/FancyBold.vue +17 -0
- package/app/components/FancyCard.vue +58 -0
- package/app/components/FancyCardTag.vue +16 -0
- package/app/components/Prose.vue +51 -0
- package/app/components/ScrollHolder.vue +20 -0
- package/app/components/SmartMedia.vue +112 -0
- package/app/components/ads/Ads.vue +39 -33
- package/app/components/ads/AdsBannerAside.vue +46 -61
- package/app/components/ads/AdsBannerBottom.vue +17 -22
- package/app/components/ads/AdsReplacer.vue +28 -73
- package/app/components/ads/provider/Custom.vue +19 -0
- package/app/components/ads/{AdsProviderYandex.vue → provider/Yandex.vue} +84 -91
- package/app/components/aside/AsideListItem.vue +66 -91
- package/app/components/aside/AsideMajor.vue +8 -56
- package/app/components/aside/AsideMinor.vue +76 -97
- package/app/components/aside/AsideSwitch.vue +67 -0
- package/app/components/aside/major/PaneHolder.vue +106 -0
- package/app/components/aside/major/PaneSwitcher.vue +73 -0
- package/app/components/aside/major/PaneSwitcherButton.vue +38 -0
- package/app/components/aside/major/PaneTemplate.vue +5 -0
- package/app/components/aside/major/SiteInfo.vue +68 -85
- package/app/components/aside/major/contentNav/PaneBookNav.vue +116 -0
- package/app/components/aside/major/contentNav/PaneGlobalNav.vue +24 -0
- package/app/components/aside/major/contentNav/items/ContentNavBook.vue +21 -0
- package/app/components/aside/major/contentNav/items/ContentNavFolder.vue +92 -0
- package/app/components/aside/major/contentNav/items/ContentNavItem.vue +33 -0
- package/app/components/aside/major/contentNav/items/ContentNavPage.vue +18 -0
- package/app/components/aside/major/contentNav/items/ContentNavSeparator.vue +62 -0
- package/app/components/aside/major/contentNav/items/ContentNavTopic.vue +18 -0
- package/app/components/aside/major/contentNav/items/Flags.vue +52 -0
- package/app/components/aside/major/contentNav/items/ItemTemplate.vue +27 -0
- package/app/components/aside/major/languages/PaneLanguages.vue +55 -0
- package/app/components/aside/major/pages/PanePages.vue +60 -0
- package/app/components/aside/major/search/PaneSearch.vue +145 -0
- package/app/components/aside/major/search/SearchInput.vue +104 -0
- package/app/components/aside/major/search/SearchResult.vue +103 -0
- package/app/components/aside/major/search/SearchStatus.vue +48 -0
- package/app/components/aside/major/search/search.worker.ts +164 -0
- package/app/components/aside/major/settings/BuildTime.vue +25 -0
- package/app/components/aside/major/settings/EngineVersion.vue +13 -0
- package/app/components/aside/major/settings/PaneSettings.vue +17 -0
- package/app/components/aside/major/settings/ThemeSwitcher.vue +53 -0
- package/app/components/aside/major/settings/repository/Repository.vue +33 -0
- package/app/components/aside/major/settings/repository/SecondaryGitHub.vue +71 -0
- package/app/components/aside/minor/AsideMinorPane.vue +1 -11
- package/app/components/aside/minor/AsideMinorPlainHeader.vue +21 -0
- package/app/components/aside/minor/content/AsideMinorContentContributions.vue +53 -0
- package/app/components/aside/minor/content/AsideMinorContentPage.vue +37 -0
- package/app/components/aside/minor/content/AsideMinorContentTopic.vue +66 -0
- package/app/components/aside/minor/content/ButtonPaneContributions.vue +116 -0
- package/app/components/aside/minor/content/ButtonPaneImprove.vue +121 -0
- package/app/components/aside/minor/content/Contribution.vue +34 -0
- package/app/components/aside/minor/content/Toc.vue +165 -0
- package/app/components/aside/minor/content/TocItem.vue +77 -0
- package/app/components/aside/minor/content/TopicPartButton.vue +35 -0
- package/app/components/aside/minor/contributor/AsideMinorContributor.vue +31 -68
- package/app/components/aside/minor/contributor/ItemBook.vue +39 -0
- package/app/components/aside/minor/contributor/ItemContent.vue +17 -0
- package/app/components/aside/minor/news/AsideMinorNews.vue +135 -0
- package/app/components/aside/minor/news/NewsItem.vue +69 -0
- package/app/components/aside/minor/news/RenderNewsElement.vue +42 -0
- package/app/components/aside/minor/news/elements/Mix.vue +11 -0
- package/app/components/aside/minor/news/elements/P.vue +14 -0
- package/app/components/aside/minor/news/elements/Ref.vue +58 -0
- package/app/components/aside/minor/news/elements/Text.vue +18 -0
- package/app/components/indexPage/IndexPagePersons.vue +117 -0
- package/app/components/main/MainAction.vue +20 -0
- package/app/components/main/MainBreadcrumbs.vue +28 -0
- package/app/components/main/MainContentChild.vue +48 -0
- package/app/components/main/MainContentChildren.vue +14 -0
- package/app/components/main/MainDecoration.vue +15 -0
- package/app/components/main/MainDescription.vue +6 -23
- package/app/components/main/MainFlag.vue +133 -0
- package/app/components/main/MainFlags.vue +17 -0
- package/app/components/main/MainGlow.vue +12 -0
- package/app/components/main/MainQuickLink.vue +76 -0
- package/app/components/main/MainQuickLinks.vue +42 -0
- package/app/components/main/MainQuote.vue +160 -0
- package/app/components/main/MainQuoteLoader.vue +86 -0
- package/app/components/main/MainSection.vue +39 -42
- package/app/components/main/MainSectionPreamble.vue +5 -0
- package/app/components/main/MainSubTitle.vue +12 -0
- package/app/components/main/MainTitle.vue +26 -69
- package/app/components/main/MainTopicPartPage.vue +88 -0
- package/app/components/main/MainTopicPartSwitch.vue +71 -0
- package/app/components/main/connections/Deps.vue +34 -0
- package/app/components/main/connections/Externals.vue +46 -0
- package/app/components/main/connections/MainConnections.vue +41 -0
- package/app/components/main/connections/MainConnectionsButton.vue +80 -0
- package/app/components/main/connections/ScrollPane.vue +11 -0
- package/app/components/main/contentStats/Item.vue +35 -0
- package/app/components/main/contentStats/ItemElement.vue +19 -0
- package/app/components/main/contentStats/ItemMaterials.vue +11 -0
- package/app/components/main/contentStats/MainContentStats.vue +50 -0
- package/app/components/preview/Preview.vue +173 -186
- package/app/components/preview/PreviewError.vue +10 -0
- package/app/components/preview/PreviewLoading.vue +5 -14
- package/app/components/preview/PreviewScreen.vue +65 -141
- package/app/components/preview/PreviewScreenButton.vue +39 -0
- package/app/components/preview/screen/ContentPage.vue +50 -0
- package/app/components/preview/screen/DirectLink.vue +23 -0
- package/app/components/preview/screen/Unique.vue +54 -0
- package/app/components/site/SiteAside.vue +70 -0
- package/app/components/site/SiteAsideOverlay.vue +21 -0
- package/app/components/site/SiteMain.vue +16 -0
- package/app/components/transition/Fade.vue +30 -19
- package/app/components/transition/Slide.vue +47 -0
- package/app/components/tree/TreeContainer.vue +5 -11
- package/app/components/tree/TreeItem.vue +40 -93
- package/app/composables/ads.ts +17 -0
- package/app/composables/analytics.ts +102 -0
- package/app/composables/appElements.ts +40 -0
- package/app/composables/aside.ts +28 -0
- package/app/composables/asideMajorPane.ts +135 -0
- package/app/composables/asideMinor.ts +109 -0
- package/app/composables/contentNav.ts +7 -0
- package/app/composables/favicon.ts +104 -4
- package/app/composables/file.ts +3 -0
- package/app/composables/formatText.ts +78 -81
- package/app/composables/loading.ts +2 -0
- package/app/composables/mainContent.ts +31 -0
- package/app/composables/og.ts +169 -0
- package/app/composables/phrases.ts +126 -77
- package/app/composables/preview.ts +53 -0
- package/app/composables/route.ts +4 -0
- package/app/composables/theme.ts +71 -50
- package/app/composables/url.ts +22 -43
- package/app/formatters/ru.ts +14 -0
- package/app/pages/article/[...articleId].vue +10 -1
- package/app/pages/book/[...bookId].vue +50 -11
- package/app/pages/contributor/[contributorId].vue +127 -203
- package/app/pages/contributors.vue +80 -164
- package/app/pages/group/[...groupId].vue +52 -11
- package/app/pages/index.vue +101 -186
- package/app/pages/page/[...pageId].vue +60 -0
- package/app/pages/practice/[...practiceId].vue +12 -0
- package/app/pages/sponsors.vue +66 -76
- package/app/pages/summary/[...summaryId].vue +10 -1
- package/app/plugins/appSetup/client/htmlBranding.ts +6 -0
- package/app/plugins/appSetup/client/welcome.ts +35 -0
- package/app/plugins/appSetup/config.ts +6 -0
- package/app/plugins/appSetup/global.ts +3 -0
- package/app/plugins/appSetup/index.ts +28 -0
- package/app/plugins/prerender.server.ts +16 -11
- package/app/router.options.ts +5 -0
- package/app/scripts/theme.js +33 -0
- package/app/styles/main.css +173 -0
- package/bin/erudit.mjs +2 -2
- package/modules/erudit/globals/content.ts +4 -0
- package/modules/erudit/globals/contributor.ts +1 -0
- package/modules/erudit/globals/eruditConfig.ts +10 -0
- package/modules/erudit/globals/problem.ts +1 -0
- package/modules/erudit/globals/prose.ts +1 -0
- package/modules/erudit/globals/public.ts +18 -0
- package/modules/erudit/index.ts +60 -0
- package/{module → modules/erudit}/logger.ts +2 -2
- package/modules/erudit/setup/aliases.ts +17 -0
- package/modules/erudit/setup/baseUrl.ts +19 -0
- package/modules/erudit/setup/elements/appTemplate.ts +45 -0
- package/modules/erudit/setup/elements/globalTemplate.ts +82 -0
- package/modules/erudit/setup/elements/globalTypes.ts +273 -0
- package/modules/erudit/setup/elements/setup.ts +167 -0
- package/modules/erudit/setup/elements/shared.ts +10 -0
- package/modules/erudit/setup/elements/tagsTable.ts +28 -0
- package/modules/erudit/setup/fullRestart.ts +71 -0
- package/modules/erudit/setup/globals.ts +196 -0
- package/modules/erudit/setup/nuxtConfig.ts +48 -0
- package/modules/erudit/setup/projectConfig.ts +114 -0
- package/modules/erudit/setup/publicAssets.ts +52 -0
- package/modules/erudit/setup/runtimeConfig.ts +58 -0
- package/modules/erudit/watcher.ts +27 -0
- package/nuxt.config.ts +66 -102
- package/package.json +36 -18
- package/proxy/prose.app.ts +1 -0
- package/proxy/prose.ts +1 -0
- package/public/favicons/default.svg +1 -0
- package/{app/public → public}/logotype.svg +1 -1
- package/public/og.png +0 -0
- package/server/api/aside/major/frontNav/book/[...shortId].ts +10 -0
- package/server/api/aside/major/frontNav/global.ts +5 -0
- package/server/api/aside/major/pages.ts +6 -0
- package/server/api/contributor/list.ts +36 -35
- package/server/api/contributor/page/[contributorId].ts +58 -4
- package/server/api/indexPage.ts +81 -0
- package/server/api/language/functions.ts +6 -7
- package/server/api/language/phrase/[phraseKey].ts +32 -0
- package/server/api/main/content/[...contentTypePath].ts +153 -0
- package/server/api/news/batch/[batchIndex].ts +5 -0
- package/server/api/pageSponsors.ts +56 -0
- package/server/api/prerender/content.ts +82 -0
- package/server/api/prerender/files.ts +10 -0
- package/server/api/prerender/frontNav.ts +13 -0
- package/server/api/prerender/language.ts +3 -5
- package/server/api/prerender/news.ts +8 -0
- package/server/api/prerender/quotes.ts +15 -0
- package/server/api/preview/contentPage/[...contentTypePath].ts +63 -0
- package/server/api/preview/contentUnique/[...contentTypePathUnique].ts +81 -0
- package/server/api/problemScript/[...problemScriptPath].ts +92 -0
- package/server/api/quote/data/[quoteId].ts +87 -0
- package/server/api/quote/ids.ts +3 -0
- package/server/erudit/build.ts +135 -0
- package/server/erudit/cameos/build.ts +111 -0
- package/server/erudit/config.ts +11 -0
- package/server/erudit/content/global/build.ts +271 -0
- package/server/erudit/content/global/singleton.ts +5 -0
- package/server/erudit/content/nav/build.ts +431 -0
- package/server/erudit/content/nav/front.ts +130 -0
- package/server/erudit/content/nav/repository/books.ts +40 -0
- package/server/erudit/content/nav/repository/get.ts +33 -0
- package/server/erudit/content/nav/repository/hasChildren.ts +5 -0
- package/server/erudit/content/nav/repository/hasNav.ts +3 -0
- package/server/erudit/content/nav/repository/hasParent.ts +5 -0
- package/server/erudit/content/nav/repository/id.ts +9 -0
- package/server/erudit/content/nav/repository/index.ts +9 -0
- package/server/erudit/content/nav/repository/order.ts +14 -0
- package/server/erudit/content/nav/repository/previousNext.ts +35 -0
- package/server/erudit/content/nav/repository/walk.ts +127 -0
- package/server/erudit/content/nav/setup.ts +13 -0
- package/server/erudit/content/nav/types.ts +24 -0
- package/server/erudit/content/repository/breadcrumbs.ts +24 -0
- package/server/erudit/content/repository/children.ts +47 -0
- package/server/erudit/content/repository/connections.ts +35 -0
- package/server/erudit/content/repository/contentLink.ts +16 -0
- package/server/erudit/content/repository/decoration.ts +23 -0
- package/server/erudit/content/repository/deps.ts +84 -0
- package/server/erudit/content/repository/description.ts +11 -0
- package/server/erudit/content/repository/elementSnippets.ts +64 -0
- package/server/erudit/content/repository/externals.ts +25 -0
- package/server/erudit/content/repository/flags.ts +33 -0
- package/server/erudit/content/repository/seo.ts +12 -0
- package/server/erudit/content/repository/stats.ts +97 -0
- package/server/erudit/content/repository/title.ts +27 -0
- package/server/erudit/content/repository/topicParts.ts +39 -0
- package/server/erudit/content/repository/unique.ts +76 -0
- package/server/erudit/content/resolve/book.ts +32 -0
- package/server/erudit/content/resolve/group.ts +39 -0
- package/server/erudit/content/resolve/index.ts +139 -0
- package/server/erudit/content/resolve/page.ts +87 -0
- package/server/erudit/content/resolve/topic.ts +113 -0
- package/server/erudit/content/resolve/utils/contentError.ts +10 -0
- package/server/erudit/content/resolve/utils/insertContentItem.ts +122 -0
- package/server/erudit/content/resolve/utils/insertContentResolved.ts +93 -0
- package/server/erudit/content/search.ts +135 -0
- package/server/erudit/contributors/build.ts +111 -0
- package/server/erudit/contributors/global.ts +3 -0
- package/server/erudit/contributors/repository/avatarUrl.ts +10 -0
- package/server/erudit/contributors/repository/contributions.ts +178 -0
- package/server/erudit/contributors/repository/count.ts +3 -0
- package/server/erudit/contributors/search.ts +34 -0
- package/server/erudit/db/repository/pushFile.ts +23 -0
- package/server/erudit/db/repository/pushProblemScript.ts +19 -0
- package/server/erudit/db/repository/pushProseLink.ts +40 -0
- package/server/erudit/db/schema/cameos.ts +7 -0
- package/server/erudit/db/schema/content.ts +18 -0
- package/server/erudit/db/schema/contentContributions.ts +15 -0
- package/server/erudit/db/schema/contentDeps.ts +21 -0
- package/server/erudit/db/schema/contentElementStats.ts +20 -0
- package/server/erudit/db/schema/contentProseLinks.ts +23 -0
- package/server/erudit/db/schema/contentSnippets.ts +32 -0
- package/server/erudit/db/schema/contentToc.ts +16 -0
- package/server/erudit/db/schema/contentUniques.ts +25 -0
- package/server/erudit/db/schema/contributors.ts +12 -0
- package/server/erudit/db/schema/files.ts +11 -0
- package/server/erudit/db/schema/groups.ts +6 -0
- package/server/erudit/db/schema/index.ts +17 -0
- package/server/erudit/db/schema/news.ts +7 -0
- package/server/erudit/db/schema/pages.ts +7 -0
- package/server/erudit/db/schema/problemScripts.ts +14 -0
- package/server/erudit/db/schema/sponsors.ts +9 -0
- package/server/erudit/db/schema/topics.ts +9 -0
- package/server/erudit/db/setup.ts +62 -0
- package/server/erudit/db/types.ts +10 -0
- package/server/erudit/global.ts +33 -0
- package/server/erudit/importer.ts +97 -0
- package/server/erudit/index.ts +90 -0
- package/server/erudit/language/list/en.ts +209 -0
- package/server/erudit/language/list/ru.ts +214 -0
- package/server/erudit/language/list.ts +6 -0
- package/server/erudit/language/setup.ts +36 -0
- package/server/erudit/language/types.ts +16 -0
- package/server/erudit/logger.ts +77 -0
- package/server/erudit/news/build.ts +77 -0
- package/server/erudit/news/repository/batch.ts +61 -0
- package/server/erudit/prose/repository/finalize.ts +68 -0
- package/server/erudit/prose/repository/get.ts +54 -0
- package/server/erudit/prose/repository/resolve.ts +17 -0
- package/server/erudit/prose/storage/callout.ts +14 -0
- package/server/erudit/prose/storage/image.ts +20 -0
- package/server/erudit/prose/storage/link.ts +226 -0
- package/server/erudit/prose/storage/problemScript.ts +21 -0
- package/server/erudit/prose/storage/video.ts +14 -0
- package/server/erudit/prose/transform/bundleProblemScript.ts +6 -0
- package/server/erudit/prose/transform/extensions.ts +15 -0
- package/server/erudit/quote/repository/ids.ts +31 -0
- package/server/erudit/repository.ts +96 -0
- package/server/erudit/sponsors/build.ts +114 -0
- package/server/erudit/sponsors/repository/avatarUrl.ts +10 -0
- package/server/erudit/sponsors/repository/count.ts +4 -0
- package/server/erudit/staticFile.ts +28 -0
- package/server/plugins/augmentCss.ts +17 -0
- package/server/plugins/lang.ts +7 -0
- package/server/plugins/metaViewport.ts +15 -0
- package/server/plugins/theme.ts +13 -0
- package/server/routes/file/[...path].ts +18 -0
- package/server/routes/robots.txt.ts +1 -1
- package/server/routes/search.json.gz.ts +72 -0
- package/server/routes/sitemap.xml.ts +61 -90
- package/shared/search/encoders.ts +20 -0
- package/shared/types/asideMajorPages.ts +4 -0
- package/shared/types/breadcrumbs.ts +9 -0
- package/shared/types/contentChildren.ts +10 -0
- package/shared/types/contentConnections.ts +27 -0
- package/shared/types/contentStats.ts +6 -0
- package/shared/types/elementSnippet.ts +8 -0
- package/shared/types/frontContentNav.ts +38 -0
- package/shared/types/indexPage.ts +20 -0
- package/shared/types/language.ts +189 -89
- package/shared/types/mainContent.ts +69 -0
- package/shared/types/news.ts +13 -0
- package/shared/types/preview.ts +28 -0
- package/shared/types/runtimeConfig.ts +64 -0
- package/shared/types/search.ts +79 -0
- package/shared/utils/contentTypePath.ts +63 -0
- package/shared/utils/icons.ts +11 -0
- package/shared/utils/pages.ts +24 -0
- package/shared/utils/slasher.ts +64 -0
- package/shared/utils/stringColor.ts +13 -9
- package/shared/utils/toStringEqual.ts +21 -0
- package/shared/utils/zip.ts +64 -0
- package/test/shared/utils/slasher.test.ts +75 -0
- package/test/shared/utils/zip.test.ts +8 -0
- package/tsconfig.json +17 -8
- package/app/assets/icons/alert.svg +0 -3
- package/app/assets/icons/angle-right.svg +0 -3
- package/app/assets/icons/arrow-in-text.svg +0 -3
- package/app/assets/icons/arrow-left.svg +0 -3
- package/app/assets/icons/arrow-up-to-right.svg +0 -3
- package/app/assets/icons/cameo-add.svg +0 -3
- package/app/assets/icons/chip.svg +0 -3
- package/app/assets/icons/circle-help.svg +0 -3
- package/app/assets/icons/cross.svg +0 -3
- package/app/assets/icons/ellipsis-vertical.svg +0 -3
- package/app/assets/icons/file-check.svg +0 -3
- package/app/assets/icons/file-star.svg +0 -3
- package/app/assets/icons/link-external.svg +0 -3
- package/app/assets/icons/link.svg +0 -3
- package/app/assets/icons/list-squared.svg +0 -3
- package/app/assets/icons/outline/book.svg +0 -3
- package/app/assets/icons/outline/file-lines.svg +0 -3
- package/app/assets/icons/pirate.svg +0 -3
- package/app/assets/icons/search.svg +0 -3
- package/app/assets/icons/shuffle.svg +0 -3
- package/app/assets/icons/star.svg +0 -3
- package/app/components/Avatar.vue +0 -118
- package/app/components/EruditLink.vue +0 -17
- package/app/components/GroupLikePage.vue +0 -70
- package/app/components/Loading.vue +0 -23
- package/app/components/QuickLinks.vue +0 -99
- package/app/components/SiteAside.vue +0 -393
- package/app/components/SiteMain.vue +0 -32
- package/app/components/ads/AdsProviderCustom.vue +0 -35
- package/app/components/aside/major/PaneContentScroll.vue +0 -23
- package/app/components/aside/major/PaneSwitch.vue +0 -54
- package/app/components/aside/major/PaneSwitchButton.vue +0 -63
- package/app/components/aside/major/panes/Language.vue +0 -79
- package/app/components/aside/major/panes/Pages.vue +0 -50
- package/app/components/aside/major/panes/Search.vue +0 -11
- package/app/components/aside/major/panes/nav/Nav.vue +0 -92
- package/app/components/aside/major/panes/nav/NavBook.vue +0 -95
- package/app/components/aside/major/panes/nav/NavBookLoading.vue +0 -24
- package/app/components/aside/major/panes/nav/NavGlobal.vue +0 -16
- package/app/components/aside/major/panes/nav/fnav/FNav.vue +0 -105
- package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +0 -32
- package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +0 -40
- package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +0 -60
- package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +0 -34
- package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +0 -80
- package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +0 -24
- package/app/components/aside/major/panes/other/ItemContent.vue +0 -29
- package/app/components/aside/major/panes/other/ItemGenerator.vue +0 -13
- package/app/components/aside/major/panes/other/ItemTheme.vue +0 -49
- package/app/components/aside/major/panes/other/Other.vue +0 -16
- package/app/components/aside/minor/AsideMinorContribute.vue +0 -175
- package/app/components/aside/minor/AsideMinorNews.vue +0 -11
- package/app/components/aside/minor/AsideMinorTopLink.vue +0 -66
- package/app/components/aside/minor/content/AsideMinorContent.vue +0 -89
- package/app/components/aside/minor/contributor/BookContribution.vue +0 -64
- package/app/components/aside/minor/topic/AsideMinorTopic.vue +0 -31
- package/app/components/aside/minor/topic/TopicContributors.vue +0 -183
- package/app/components/aside/minor/topic/TopicNav.vue +0 -49
- package/app/components/aside/minor/topic/TopicToc.vue +0 -212
- package/app/components/aside/minor/topic/TopicTocItem.vue +0 -19
- package/app/components/aside/utils/AsideOverlayPane.vue +0 -40
- package/app/components/bitran/BitranContent.vue +0 -90
- package/app/components/bitran/RenderWrapper.vue +0 -10
- package/app/components/contributor/ContributorListItem.vue +0 -43
- package/app/components/index/IndexAvatars.vue +0 -143
- package/app/components/main/MainActionButton.vue +0 -53
- package/app/components/main/MainBitranContent.vue +0 -68
- package/app/components/main/MainBreadcrumb.vue +0 -63
- package/app/components/main/MainSectionTitle.vue +0 -50
- package/app/components/main/MainSourceUsages.vue +0 -119
- package/app/components/main/MainSourcesUsage.vue +0 -60
- package/app/components/main/MainToc.vue +0 -135
- package/app/components/main/cameo/MainCameo.vue +0 -135
- package/app/components/main/cameo/MainCameoData.vue +0 -232
- package/app/components/main/content/ContentBreadcrumb.vue +0 -28
- package/app/components/main/content/ContentDecoration.vue +0 -29
- package/app/components/main/content/ContentPopover.vue +0 -188
- package/app/components/main/content/ContentPopovers.vue +0 -118
- package/app/components/main/content/ContentReferences.vue +0 -44
- package/app/components/main/content/reference/ReferenceGroup.vue +0 -39
- package/app/components/main/content/reference/ReferenceItem.vue +0 -70
- package/app/components/main/content/reference/ReferenceSource.vue +0 -121
- package/app/components/main/topic/MainTopic.vue +0 -73
- package/app/components/main/topic/MainTopicQuickLinks.vue +0 -24
- package/app/components/main/topic/TopicPartSwitch.vue +0 -119
- package/app/components/preview/PreviewDisplay.vue +0 -139
- package/app/components/preview/PreviewFooterAction.vue +0 -73
- package/app/components/preview/display/Alert.vue +0 -50
- package/app/components/preview/display/Custom.vue +0 -18
- package/app/components/preview/display/GenericLink.vue +0 -48
- package/app/components/preview/display/PageLink.vue +0 -22
- package/app/components/preview/display/Unique.vue +0 -46
- package/app/components/sponsor/SponsorTier1.vue +0 -89
- package/app/components/sponsor/SponsorTier2.vue +0 -109
- package/app/components/stats/Stats.vue +0 -21
- package/app/components/stats/StatsGroupLike.vue +0 -24
- package/app/components/stats/StatsItem.vue +0 -33
- package/app/components/stats/StatsItemElement.vue +0 -13
- package/app/composables/adsAllowed.ts +0 -11
- package/app/composables/asset.ts +0 -12
- package/app/composables/bitran.ts +0 -108
- package/app/composables/bitranLocation.ts +0 -6
- package/app/composables/contentData.ts +0 -38
- package/app/composables/contentPage.ts +0 -169
- package/app/composables/contentRoute.ts +0 -45
- package/app/composables/darkMagic.ts +0 -24
- package/app/composables/externalApi.ts +0 -69
- package/app/composables/head.ts +0 -24
- package/app/composables/majorPane.ts +0 -62
- package/app/pages/_test/preview.vue +0 -110
- package/app/pages/practice/[...practice].vue +0 -3
- package/app/plugins/analytics.ts +0 -95
- package/app/public/favicon/article.svg +0 -10
- package/app/public/favicon/default.svg +0 -10
- package/app/public/favicon/practice.svg +0 -10
- package/app/public/favicon/summary.svg +0 -10
- package/app/public/og-default.png +0 -0
- package/app/scripts/_immediate.js +0 -9
- package/app/scripts/aside/index.ts +0 -59
- package/app/scripts/aside/major/nav.ts +0 -26
- package/app/scripts/aside/minor/state.ts +0 -37
- package/app/scripts/flag.ts +0 -28
- package/app/scripts/og.ts +0 -28
- package/app/scripts/preview/build.ts +0 -76
- package/app/scripts/preview/data/alert.ts +0 -19
- package/app/scripts/preview/data/custom.ts +0 -8
- package/app/scripts/preview/data/genericLink.ts +0 -24
- package/app/scripts/preview/data/pageLink.ts +0 -24
- package/app/scripts/preview/data/unique.ts +0 -69
- package/app/scripts/preview/data.ts +0 -24
- package/app/scripts/preview/display.ts +0 -37
- package/app/scripts/preview/footer.ts +0 -9
- package/app/scripts/preview/request.ts +0 -51
- package/app/scripts/preview/state.ts +0 -63
- package/app/styles/_immediate.css +0 -7
- package/app/styles/_util.scss +0 -43
- package/app/styles/_utils.scss +0 -44
- package/app/styles/app.scss +0 -91
- package/app/styles/def/_bp.scss +0 -27
- package/app/styles/def/_size.scss +0 -7
- package/app/styles/def/_z.scss +0 -5
- package/app/styles/normalize.scss +0 -49
- package/app/styles/partials/_darkMagic.scss +0 -5
- package/app/styles/partials/_fnav.scss +0 -15
- package/app/styles/partials/_preview.scss +0 -5
- package/const.ts +0 -3
- package/globalPath.ts +0 -21
- package/globals/bitran.ts +0 -1
- package/globals/cameo.ts +0 -5
- package/globals/content.ts +0 -27
- package/globals/contributor.ts +0 -5
- package/globals/erudit.ts +0 -5
- package/globals/register.ts +0 -23
- package/globals/sponsor.ts +0 -17
- package/languages/en.ts +0 -114
- package/languages/ru.ts +0 -119
- package/module/bitran.ts +0 -66
- package/module/config.ts +0 -35
- package/module/imports.ts +0 -74
- package/module/index.ts +0 -47
- package/module/paths.ts +0 -22
- package/module/restart.ts +0 -61
- package/server/api/aside/major/nav/bookIds.ts +0 -5
- package/server/api/aside/major/nav/bookNav/[...bookId].ts +0 -17
- package/server/api/aside/major/nav/global.ts +0 -7
- package/server/api/aside/minor/book/[...bookId].ts +0 -18
- package/server/api/aside/minor/contributor/[contributorId].ts +0 -18
- package/server/api/aside/minor/group/[...groupId].ts +0 -18
- package/server/api/aside/minor/news.ts +0 -7
- package/server/api/aside/minor/topic.ts +0 -36
- package/server/api/bitran/content/[...location].ts +0 -13
- package/server/api/bitran/toc/[...location].ts +0 -9
- package/server/api/cameo/data/[cameoId].ts +0 -42
- package/server/api/cameo/ids.ts +0 -5
- package/server/api/content/data.ts +0 -97
- package/server/api/contributor/count.ts +0 -6
- package/server/api/fake/content.ts +0 -11
- package/server/api/fake/shared/languages.ts +0 -12
- package/server/api/index/data.ts +0 -46
- package/server/api/language/phrase/[phraseId].ts +0 -19
- package/server/api/language/phraseIds.ts +0 -8
- package/server/api/prerender/assets/cameo.ts +0 -14
- package/server/api/prerender/assets/contributor.ts +0 -12
- package/server/api/prerender/assets/sponsor.ts +0 -13
- package/server/api/prerender/cameos.ts +0 -12
- package/server/api/preview/page/[...parts].ts +0 -78
- package/server/api/preview/unique/[...location].ts +0 -48
- package/server/api/problem/generator/[...path].ts +0 -26
- package/server/api/sponsor/cameo/data/[sponsorId].ts +0 -51
- package/server/api/sponsor/cameo/ids.ts +0 -5
- package/server/api/sponsor/count.ts +0 -5
- package/server/api/sponsor/list.ts +0 -36
- package/server/plugin/bitran/content.ts +0 -238
- package/server/plugin/bitran/elements/include.ts +0 -229
- package/server/plugin/bitran/location.ts +0 -40
- package/server/plugin/bitran/toc.ts +0 -94
- package/server/plugin/bitran/transpiler.ts +0 -18
- package/server/plugin/build/close.ts +0 -12
- package/server/plugin/build/jobs/content/builderArgs.ts +0 -8
- package/server/plugin/build/jobs/content/generic.ts +0 -191
- package/server/plugin/build/jobs/content/parse.ts +0 -207
- package/server/plugin/build/jobs/content/path.ts +0 -6
- package/server/plugin/build/jobs/content/type/book.ts +0 -9
- package/server/plugin/build/jobs/content/type/group.ts +0 -16
- package/server/plugin/build/jobs/content/type/topic.ts +0 -36
- package/server/plugin/build/jobs/contributors.ts +0 -69
- package/server/plugin/build/jobs/language.ts +0 -36
- package/server/plugin/build/jobs/nav.ts +0 -345
- package/server/plugin/build/process.ts +0 -34
- package/server/plugin/build/rebuild.ts +0 -68
- package/server/plugin/build/setup.ts +0 -19
- package/server/plugin/content/context.ts +0 -116
- package/server/plugin/db/entities/Book.ts +0 -7
- package/server/plugin/db/entities/Content.ts +0 -45
- package/server/plugin/db/entities/Contribution.ts +0 -10
- package/server/plugin/db/entities/Contributor.ts +0 -25
- package/server/plugin/db/entities/File.ts +0 -10
- package/server/plugin/db/entities/Group.ts +0 -11
- package/server/plugin/db/entities/Hash.ts +0 -15
- package/server/plugin/db/entities/QuickLink.ts +0 -19
- package/server/plugin/db/entities/Stat.ts +0 -13
- package/server/plugin/db/entities/Topic.ts +0 -20
- package/server/plugin/db/entities/Unique.ts +0 -21
- package/server/plugin/db/reset.ts +0 -12
- package/server/plugin/db/setup.ts +0 -53
- package/server/plugin/global.ts +0 -18
- package/server/plugin/importer.ts +0 -16
- package/server/plugin/index.ts +0 -9
- package/server/plugin/logger.ts +0 -23
- package/server/plugin/nav/node.ts +0 -27
- package/server/plugin/nav/utils.ts +0 -179
- package/server/plugin/repository/asideMinor.ts +0 -51
- package/server/plugin/repository/book.ts +0 -39
- package/server/plugin/repository/cameo.ts +0 -16
- package/server/plugin/repository/content.ts +0 -240
- package/server/plugin/repository/contentId.ts +0 -40
- package/server/plugin/repository/contentToc.ts +0 -90
- package/server/plugin/repository/contributor.ts +0 -129
- package/server/plugin/repository/elementStats.ts +0 -80
- package/server/plugin/repository/file.ts +0 -10
- package/server/plugin/repository/frontNav.ts +0 -145
- package/server/plugin/repository/link.ts +0 -20
- package/server/plugin/repository/quickLink.ts +0 -36
- package/server/plugin/repository/readLink.ts +0 -17
- package/server/plugin/repository/reference.ts +0 -78
- package/server/plugin/repository/topic.ts +0 -35
- package/server/plugin/repository/topicCount.ts +0 -19
- package/server/plugin/sponsor/build.ts +0 -82
- package/server/plugin/sponsor/index.ts +0 -5
- package/server/plugin/sponsor/repository.ts +0 -56
- package/server/routes/asset/[...assetPath].ts +0 -34
- package/server/tsconfig.json +0 -9
- package/shared/aside/minor.ts +0 -55
- package/shared/asset.ts +0 -17
- package/shared/bitran/content.ts +0 -9
- package/shared/bitran/contentId.ts +0 -56
- package/shared/bitran/toc.ts +0 -8
- package/shared/breadcrumb.ts +0 -7
- package/shared/content/bookId.ts +0 -12
- package/shared/content/context.ts +0 -9
- package/shared/content/data/base.ts +0 -32
- package/shared/content/data/groupLike.ts +0 -11
- package/shared/content/data/index.ts +0 -5
- package/shared/content/data/type/book.ts +0 -7
- package/shared/content/data/type/group.ts +0 -8
- package/shared/content/data/type/topic.ts +0 -13
- package/shared/content/previousNext.ts +0 -9
- package/shared/content/reference.ts +0 -18
- package/shared/content/toc.ts +0 -35
- package/shared/contributor.ts +0 -34
- package/shared/frontNav.ts +0 -41
- package/shared/icons.ts +0 -38
- package/shared/image.ts +0 -5
- package/shared/indexData.ts +0 -10
- package/shared/link.ts +0 -29
- package/shared/popover.ts +0 -8
- package/shared/quickLink.ts +0 -7
- package/shared/stat.ts +0 -23
- package/shared/utils/objectsEqual.ts +0 -4
- package/test/contentId.test.ts +0 -91
- package/test/utils/url.test.ts +0 -99
- package/utils/contentPath.ts +0 -67
- package/utils/ext.ts +0 -41
- package/utils/normalize.ts +0 -7
- package/utils/stress.ts +0 -9
- package/utils/url.ts +0 -23
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { globSync } from 'glob';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
import {
|
|
6
|
-
contentTypes,
|
|
7
|
-
topicParts,
|
|
8
|
-
type ContentType,
|
|
9
|
-
} from '@erudit-js/cog/schema';
|
|
10
|
-
|
|
11
|
-
import { PROJECT_DIR } from '#erudit/globalPaths';
|
|
12
|
-
import { stress } from '@erudit/utils/stress';
|
|
13
|
-
import { debug, logger } from '@server/logger';
|
|
14
|
-
import {
|
|
15
|
-
createRootNode,
|
|
16
|
-
isRootNode,
|
|
17
|
-
type NavNode,
|
|
18
|
-
type RootNavNode,
|
|
19
|
-
} from '@server/nav/node';
|
|
20
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
21
|
-
import { jiti } from '@server/importer';
|
|
22
|
-
|
|
23
|
-
type Ids = Record<string, string>;
|
|
24
|
-
let fullIds: Ids;
|
|
25
|
-
|
|
26
|
-
const nodePathRegexp = new RegExp(
|
|
27
|
-
`(?<pos>\\d+)(?<sep>-|\\+)(?<id>[\\w-]+)\\/(?<type>${contentTypes.join('|')})\\..*`,
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const contentFilter = createContentFilter();
|
|
31
|
-
|
|
32
|
-
export async function buildNav() {
|
|
33
|
-
debug.start('Building navigation tree...');
|
|
34
|
-
|
|
35
|
-
fullIds = {};
|
|
36
|
-
|
|
37
|
-
const rootNode = createRootNode();
|
|
38
|
-
rootNode.children = (await scanChildNodes(rootNode, false)).children;
|
|
39
|
-
ERUDIT_SERVER.NAV = rootNode.children ? rootNode : undefined;
|
|
40
|
-
|
|
41
|
-
const nodeCount = Object.values(fullIds).length;
|
|
42
|
-
|
|
43
|
-
if (nodeCount === 0) {
|
|
44
|
-
logger.warn('No content nodes detected! The site will be empty!');
|
|
45
|
-
} else {
|
|
46
|
-
if (ERUDIT_SERVER.CONFIG?.debug?.log) debugPrintNav(rootNode);
|
|
47
|
-
|
|
48
|
-
writeCompilerOptionsPaths();
|
|
49
|
-
writeJitiAliases();
|
|
50
|
-
|
|
51
|
-
logger.success(
|
|
52
|
-
'Navigation tree built successfully!',
|
|
53
|
-
chalk.dim(`(${nodeCount})`),
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async function scanChildNodes(
|
|
59
|
-
parent: NavNode | RootNavNode,
|
|
60
|
-
insideBook: boolean,
|
|
61
|
-
): Promise<{ children: NavNode[] | undefined; newIds: Ids }> {
|
|
62
|
-
const currentFsPath = isRootNode(parent) ? '' : parent.fsPath + '/';
|
|
63
|
-
|
|
64
|
-
const nodeFsPaths = globSync(
|
|
65
|
-
`${currentFsPath}*/{${contentTypes.join(',')}}.{ts,js}`,
|
|
66
|
-
{
|
|
67
|
-
cwd: PROJECT_DIR + '/content',
|
|
68
|
-
posix: true,
|
|
69
|
-
},
|
|
70
|
-
).sort();
|
|
71
|
-
|
|
72
|
-
let newIds: Ids = {};
|
|
73
|
-
const children: NavNode[] = [];
|
|
74
|
-
|
|
75
|
-
for (const nodeFsPath of nodeFsPaths) {
|
|
76
|
-
const pathParts:
|
|
77
|
-
| {
|
|
78
|
-
pos: string;
|
|
79
|
-
sep: string;
|
|
80
|
-
id: string;
|
|
81
|
-
type: ContentType;
|
|
82
|
-
}
|
|
83
|
-
| undefined = nodeFsPath.match(nodePathRegexp)?.groups as any;
|
|
84
|
-
|
|
85
|
-
if (!pathParts) continue; // Wrong path pattern
|
|
86
|
-
|
|
87
|
-
const nodePath = nodeFsPath.split('/').slice(0, -1).join('/');
|
|
88
|
-
|
|
89
|
-
if (pathParts.type === 'book' && insideBook) {
|
|
90
|
-
logger.warn(
|
|
91
|
-
'Books inside books are not allowed!\n',
|
|
92
|
-
`Skipping ${stress(nodePath)} nav node!`,
|
|
93
|
-
);
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const parentId = isRootNode(parent)
|
|
98
|
-
? ''
|
|
99
|
-
: parent.skip
|
|
100
|
-
? parent.fullId.split('/').slice(0, -1).join('/')
|
|
101
|
-
: parent.fullId;
|
|
102
|
-
|
|
103
|
-
// Regular id might not include parent id part if it is skipped
|
|
104
|
-
const id = parentId ? `${parentId}/${pathParts.id}` : pathParts.id;
|
|
105
|
-
|
|
106
|
-
if (fullIds[id]) {
|
|
107
|
-
logger.warn(
|
|
108
|
-
`Nav node ${stress(id)} ID collision!\n\n`,
|
|
109
|
-
`This ID belongs to ${stress(fullIds[id], chalk.greenBright)} nav node.\n`,
|
|
110
|
-
`Nav node ${stress(nodePath, chalk.redBright)} tries to use the same ID!\n`,
|
|
111
|
-
'Skipping nav node which causes collision!',
|
|
112
|
-
);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Full id always includes parent id
|
|
117
|
-
const fullId = isRootNode(parent)
|
|
118
|
-
? pathParts.id
|
|
119
|
-
: `${parent.fullId}/${pathParts.id}`;
|
|
120
|
-
|
|
121
|
-
// Short id skips parent ids for nodes with skip=true, except current node
|
|
122
|
-
const shortId = isRootNode(parent)
|
|
123
|
-
? pathParts.id
|
|
124
|
-
: (() => {
|
|
125
|
-
// Traverse up, skipping parent ids where skip=true
|
|
126
|
-
let ids: string[] = [];
|
|
127
|
-
let p: NavNode | RootNavNode | undefined = parent;
|
|
128
|
-
while (p && !isRootNode(p)) {
|
|
129
|
-
if (!p.skip) ids.unshift(p.idPart);
|
|
130
|
-
p = p.parent;
|
|
131
|
-
}
|
|
132
|
-
ids.push(pathParts.id);
|
|
133
|
-
return ids.join('/');
|
|
134
|
-
})();
|
|
135
|
-
|
|
136
|
-
const shouldSkip = (() => {
|
|
137
|
-
const targets = [
|
|
138
|
-
...contentFilter.cliContentTargets,
|
|
139
|
-
...(ERUDIT_SERVER.CONFIG?.contentTargets || []),
|
|
140
|
-
];
|
|
141
|
-
|
|
142
|
-
// If there are no filters, allow all nodes
|
|
143
|
-
if (targets.length === 0) {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// If the node passes at least one filter, keep it
|
|
148
|
-
for (const target of targets) {
|
|
149
|
-
if (contentFilter.strFilter(fullId, target)) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Node failed all filters, skip it
|
|
155
|
-
return true;
|
|
156
|
-
})();
|
|
157
|
-
|
|
158
|
-
if (shouldSkip) continue;
|
|
159
|
-
|
|
160
|
-
const skip = pathParts.sep === '+';
|
|
161
|
-
|
|
162
|
-
const childNode: NavNode = {
|
|
163
|
-
parent,
|
|
164
|
-
type: pathParts.type,
|
|
165
|
-
fsPath: nodePath,
|
|
166
|
-
idPart: pathParts.id,
|
|
167
|
-
fullId,
|
|
168
|
-
shortId,
|
|
169
|
-
skip,
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
if (!validNode(childNode)) continue;
|
|
173
|
-
|
|
174
|
-
fullIds[fullId] = nodePath;
|
|
175
|
-
newIds[fullId] = nodePath;
|
|
176
|
-
|
|
177
|
-
const scanResult = await scanChildNodes(
|
|
178
|
-
childNode,
|
|
179
|
-
insideBook || childNode.type === 'book',
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
['book', 'group'].includes(childNode.type) &&
|
|
184
|
-
!scanResult.children
|
|
185
|
-
) {
|
|
186
|
-
delete fullIds[fullId];
|
|
187
|
-
delete newIds[fullId];
|
|
188
|
-
for (const childNewId of Object.keys(scanResult.newIds))
|
|
189
|
-
delete fullIds[childNewId];
|
|
190
|
-
continue;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (childNode.type === 'book') {
|
|
194
|
-
ERUDIT_SERVER.NAV_BOOKS ||= {};
|
|
195
|
-
ERUDIT_SERVER.NAV_BOOKS[fullId] = childNode;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
childNode.children = scanResult.children;
|
|
199
|
-
children.push(childNode);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
children: children.length > 0 ? children : undefined,
|
|
204
|
-
newIds,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function createContentFilter() {
|
|
209
|
-
const cliContentTargets = (() => {
|
|
210
|
-
try {
|
|
211
|
-
return JSON.parse(
|
|
212
|
-
readFileSync(PROJECT_DIR + '/.erudit/targets.json', 'utf-8'),
|
|
213
|
-
);
|
|
214
|
-
} catch (error) {}
|
|
215
|
-
|
|
216
|
-
return [];
|
|
217
|
-
})();
|
|
218
|
-
|
|
219
|
-
const strFilter = (fullId: string, filterItem: string) => {
|
|
220
|
-
if (fullId.startsWith(filterItem) || filterItem.search(fullId) === 0) {
|
|
221
|
-
return true;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return false;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
return {
|
|
228
|
-
cliContentTargets,
|
|
229
|
-
strFilter,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function validNode(node: NavNode): boolean {
|
|
234
|
-
switch (node.type) {
|
|
235
|
-
case 'topic':
|
|
236
|
-
const partPaths = globSync(
|
|
237
|
-
PROJECT_DIR +
|
|
238
|
-
`/content/${node.fsPath}` +
|
|
239
|
-
`/{${topicParts.join(',')}}.bi`,
|
|
240
|
-
);
|
|
241
|
-
if (partPaths.length === 0) return false; // Topic is empty
|
|
242
|
-
break;
|
|
243
|
-
case 'book':
|
|
244
|
-
if (node.skip) {
|
|
245
|
-
logger.warn(
|
|
246
|
-
`Books can't skip their ID part!\n`,
|
|
247
|
-
`Skipping ${stress(node.fsPath)} nav node!`,
|
|
248
|
-
);
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return true;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function debugPrintNav(node: RootNavNode) {
|
|
258
|
-
const logNode = (node: NavNode | RootNavNode, indent: number) => {
|
|
259
|
-
console.log(
|
|
260
|
-
isRootNode(node)
|
|
261
|
-
? chalk.dim('#root')
|
|
262
|
-
: `${' '.repeat(indent)}${node.idPart} ${chalk.dim(`[${node.type}${node.skip ? ', ' + chalk.yellow('skip') : ''}]`)}`,
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
if (node.children)
|
|
266
|
-
for (const child of node.children) logNode(child, indent + 1);
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
logNode(node, 0);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function writeCompilerOptionsPaths() {
|
|
273
|
-
const tsconfigPath = `${PROJECT_DIR}/.erudit/tsconfig.json`;
|
|
274
|
-
|
|
275
|
-
try {
|
|
276
|
-
let tsconfig: any = {};
|
|
277
|
-
|
|
278
|
-
if (existsSync(tsconfigPath)) {
|
|
279
|
-
try {
|
|
280
|
-
tsconfig = JSON.parse(readFileSync(tsconfigPath, 'utf8'));
|
|
281
|
-
} catch (err) {
|
|
282
|
-
logger.warn(
|
|
283
|
-
`Error parsing ${tsconfigPath}, creating a new one.`,
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
289
|
-
tsconfig.compilerOptions.paths = tsconfig.compilerOptions.paths || {};
|
|
290
|
-
|
|
291
|
-
const paths = tsconfig.compilerOptions.paths;
|
|
292
|
-
|
|
293
|
-
Object.keys(paths).forEach((key) => {
|
|
294
|
-
if (key === '#content/*') {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (key.startsWith('#content/')) {
|
|
299
|
-
delete paths[key];
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
Object.entries(fullIds).forEach(([id, fsPath]) => {
|
|
304
|
-
const pathKey = `#content/${id}/*`;
|
|
305
|
-
paths[pathKey] = [`../content/${fsPath}/*`];
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4), 'utf8');
|
|
309
|
-
logger.success(`Updated tsconfig content paths!`);
|
|
310
|
-
} catch (_error) {
|
|
311
|
-
logger.error(`Failed to write compiler paths: ${_error}`);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
function writeJitiAliases() {
|
|
316
|
-
try {
|
|
317
|
-
if (!jiti.options) {
|
|
318
|
-
jiti.options = {};
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (!jiti.options.alias) {
|
|
322
|
-
jiti.options.alias = {};
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const aliases = jiti.options.alias;
|
|
326
|
-
|
|
327
|
-
Object.keys(aliases).forEach((key) => {
|
|
328
|
-
if (key === '#content/*') {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (key.startsWith('#content/')) {
|
|
333
|
-
delete aliases[key];
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
Object.entries(fullIds).forEach(([id, fsPath]) => {
|
|
338
|
-
aliases[`#content/${id}`] = `${PROJECT_DIR}/content/${fsPath}`;
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
logger.success('Updated jiti content aliases!');
|
|
342
|
-
} catch (_error) {
|
|
343
|
-
logger.error(`Failed to write jiti aliases: ${_error}`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { resetDatabase } from '@server/db/reset';
|
|
2
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
3
|
-
import { debug, logger } from '@server/logger';
|
|
4
|
-
|
|
5
|
-
import { setup } from './setup';
|
|
6
|
-
import { setupLanguage } from './jobs/language';
|
|
7
|
-
import { buildContributors } from './jobs/contributors';
|
|
8
|
-
import { buildNav } from './jobs/nav';
|
|
9
|
-
import { buildContent } from './jobs/content/generic';
|
|
10
|
-
import { buildSponsors } from '@server/sponsor/build';
|
|
11
|
-
|
|
12
|
-
let initial = true;
|
|
13
|
-
|
|
14
|
-
async function _build() {
|
|
15
|
-
debug.start('Building data...');
|
|
16
|
-
|
|
17
|
-
if (initial) {
|
|
18
|
-
await setup();
|
|
19
|
-
initial = false;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
await resetDatabase();
|
|
23
|
-
await setupLanguage();
|
|
24
|
-
await buildContributors();
|
|
25
|
-
await buildNav();
|
|
26
|
-
await buildContent();
|
|
27
|
-
await buildSponsors();
|
|
28
|
-
|
|
29
|
-
logger.success('Build successful!');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function build() {
|
|
33
|
-
ERUDIT_SERVER.BUILD_PROMISE = _build();
|
|
34
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import chokidar, { type FSWatcher } from 'chokidar';
|
|
2
|
-
|
|
3
|
-
import { ERUDIT_DIR, PROJECT_DIR } from '#erudit/globalPaths';
|
|
4
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
5
|
-
import { logger } from '@server/logger';
|
|
6
|
-
import { build } from '@server/build/process';
|
|
7
|
-
import { stress } from '@erudit/utils/stress';
|
|
8
|
-
|
|
9
|
-
const watchTargets: string[] = [
|
|
10
|
-
// Languages
|
|
11
|
-
ERUDIT_DIR + '/languages',
|
|
12
|
-
// Content directory
|
|
13
|
-
PROJECT_DIR + '/content',
|
|
14
|
-
// Contributors directory
|
|
15
|
-
PROJECT_DIR + '/contributors',
|
|
16
|
-
// Sponsors directory
|
|
17
|
-
PROJECT_DIR + '/sponsors',
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const ignoreTargets: string[] = [];
|
|
21
|
-
|
|
22
|
-
const rebuildDelay = 300;
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
let watcher: FSWatcher;
|
|
29
|
-
let rebuildTimeout: any;
|
|
30
|
-
let rebuildRequested = false;
|
|
31
|
-
let pendingRebuild = false;
|
|
32
|
-
|
|
33
|
-
export async function setupRebuildWatcher() {
|
|
34
|
-
if (watcher) return;
|
|
35
|
-
|
|
36
|
-
watcher = chokidar.watch(watchTargets, {
|
|
37
|
-
ignored: ignoreTargets,
|
|
38
|
-
ignoreInitial: true,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
watcher.on('all', (event, path) =>
|
|
42
|
-
requestServerRebuild(`File change: ${stress(path)}`),
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function requestServerRebuild(reason?: string) {
|
|
47
|
-
// If rebuild is in progress, set flag for another rebuild after completion
|
|
48
|
-
if (rebuildRequested) {
|
|
49
|
-
pendingRebuild = true;
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
clearTimeout(rebuildTimeout);
|
|
54
|
-
rebuildTimeout = setTimeout(async () => {
|
|
55
|
-
rebuildRequested = true;
|
|
56
|
-
await ERUDIT_SERVER.BUILD_PROMISE;
|
|
57
|
-
console.log('\n');
|
|
58
|
-
logger.info(`Rebuilding server data!${reason ? ` ${reason}` : ''}\n\n`);
|
|
59
|
-
await build();
|
|
60
|
-
rebuildRequested = false;
|
|
61
|
-
|
|
62
|
-
// If changes were detected during rebuild, start another rebuild
|
|
63
|
-
if (pendingRebuild) {
|
|
64
|
-
pendingRebuild = false;
|
|
65
|
-
requestServerRebuild('Changes detected during previous rebuild');
|
|
66
|
-
}
|
|
67
|
-
}, rebuildDelay);
|
|
68
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import eruditConfig from '#erudit/config';
|
|
2
|
-
|
|
3
|
-
import { registerGlobals } from '@erudit/globals/register';
|
|
4
|
-
import { debug } from '@server/logger';
|
|
5
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
6
|
-
|
|
7
|
-
import { setupRebuildWatcher } from './rebuild';
|
|
8
|
-
import { setupDatabase } from '../db/setup';
|
|
9
|
-
|
|
10
|
-
export async function setup() {
|
|
11
|
-
debug.start('Running initial setup procedures...');
|
|
12
|
-
|
|
13
|
-
if (import.meta.dev) await setupRebuildWatcher();
|
|
14
|
-
|
|
15
|
-
registerGlobals();
|
|
16
|
-
ERUDIT_SERVER.CONFIG = eruditConfig;
|
|
17
|
-
|
|
18
|
-
await setupDatabase();
|
|
19
|
-
}
|
|
@@ -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
|
-
import { getFullContentId } from '@server/repository/contentId';
|
|
13
|
-
|
|
14
|
-
import type { Context } from '@shared/content/context';
|
|
15
|
-
import { createContributorLink, createTopicPartLink } from '@shared/link';
|
|
16
|
-
import { createContentLink } from '@server/repository/link';
|
|
17
|
-
import { CONTENT_TYPE_ICON, ICON, TOPIC_PART_ICON } from '@erudit/shared/icons';
|
|
18
|
-
|
|
19
|
-
export async function getContentContext(contentId: string): Promise<Context> {
|
|
20
|
-
contentId = getFullContentId(contentId);
|
|
21
|
-
|
|
22
|
-
const context: Context = [];
|
|
23
|
-
|
|
24
|
-
for (const _contentId of 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: await createContentLink(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', 'contentId'],
|
|
110
|
-
where: { contentId },
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
if (!dbContent) throw new Error(`Content "${contentId}" not found!`);
|
|
114
|
-
|
|
115
|
-
return dbContent;
|
|
116
|
-
}
|
|
@@ -1,45 +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
|
-
type!: ContentType;
|
|
18
|
-
|
|
19
|
-
@Column('varchar', { nullable: true })
|
|
20
|
-
title?: string;
|
|
21
|
-
|
|
22
|
-
@Column('varchar', { nullable: true })
|
|
23
|
-
navTitle?: string;
|
|
24
|
-
|
|
25
|
-
@Column('text', { nullable: true })
|
|
26
|
-
description?: string;
|
|
27
|
-
|
|
28
|
-
@Column('simple-json', { nullable: true })
|
|
29
|
-
flags?: Partial<Record<ContentFlag, boolean>>;
|
|
30
|
-
|
|
31
|
-
@Column('varchar', { nullable: true })
|
|
32
|
-
decoration?: string;
|
|
33
|
-
|
|
34
|
-
@Column('simple-json', { nullable: true })
|
|
35
|
-
seo?: Partial<ContentSeo>;
|
|
36
|
-
|
|
37
|
-
@Column('simple-json', { nullable: true })
|
|
38
|
-
ogImage?: ImageData;
|
|
39
|
-
|
|
40
|
-
@Column('simple-array', { nullable: true })
|
|
41
|
-
dependencies?: string[];
|
|
42
|
-
|
|
43
|
-
@Column('simple-json', { nullable: true })
|
|
44
|
-
references?: ContentReferences;
|
|
45
|
-
}
|
|
@@ -1,25 +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('varchar', { nullable: true })
|
|
12
|
-
slogan?: string;
|
|
13
|
-
|
|
14
|
-
@Column('simple-json', { nullable: true })
|
|
15
|
-
links?: Record<string, string>;
|
|
16
|
-
|
|
17
|
-
@Column('text', { nullable: true })
|
|
18
|
-
description?: string;
|
|
19
|
-
|
|
20
|
-
@Column('varchar', { nullable: true })
|
|
21
|
-
avatar?: string;
|
|
22
|
-
|
|
23
|
-
@Column('boolean', { nullable: true })
|
|
24
|
-
isEditor?: boolean;
|
|
25
|
-
}
|
|
@@ -1,11 +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
|
-
}
|