erudit 3.0.0-dev.9 → 4.0.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.vue +24 -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 +3 -0
- 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 +3 -0
- 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 +3 -0
- 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 -0
- 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 +16 -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 -0
- package/app/components/ads/AdsBannerAside.vue +45 -0
- package/app/components/ads/AdsBannerBottom.vue +17 -0
- package/app/components/ads/AdsReplacer.vue +28 -0
- package/app/components/ads/provider/Custom.vue +19 -0
- package/app/components/ads/provider/Yandex.vue +84 -0
- package/app/components/aside/AsideListItem.vue +66 -74
- package/app/components/aside/AsideMajor.vue +8 -56
- package/app/components/aside/AsideMinor.vue +76 -71
- package/app/components/aside/AsidePlainMessage.vue +9 -0
- package/app/components/aside/AsideSwitch.vue +77 -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 +19 -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 +20 -0
- package/app/components/aside/minor/content/AsideMinorContentContributions.vue +51 -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 +114 -0
- package/app/components/aside/minor/content/ButtonPaneImprove.vue +120 -0
- package/app/components/aside/minor/content/Contribution.vue +36 -0
- package/app/components/aside/minor/content/Toc.vue +163 -0
- package/app/components/aside/minor/content/TocItem.vue +91 -0
- package/app/components/aside/minor/content/TopicPartButton.vue +35 -0
- package/app/components/aside/minor/contributor/AsideMinorContributor.vue +39 -0
- 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 +132 -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 +47 -0
- package/app/components/main/MainContentChildren.vue +14 -0
- package/app/components/main/MainDecoration.vue +15 -0
- package/app/components/main/MainDescription.vue +13 -0
- 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 +91 -0
- package/app/components/main/MainQuickLinks.vue +40 -0
- package/app/components/main/MainQuote.vue +159 -0
- package/app/components/main/MainQuoteLoader.vue +86 -0
- package/app/components/main/MainSection.vue +44 -0
- package/app/components/main/MainSectionPreamble.vue +5 -0
- package/app/components/main/MainSubTitle.vue +12 -0
- package/app/components/main/MainTitle.vue +32 -0
- 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 +104 -0
- package/app/components/main/connections/MainConnections.vue +94 -0
- package/app/components/main/connections/MainConnectionsButton.vue +81 -0
- package/app/components/main/connections/ScrollPane.vue +10 -0
- package/app/components/main/contentStats/Item.vue +34 -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 +53 -0
- package/app/components/preview/Preview.vue +172 -186
- package/app/components/preview/PreviewError.vue +10 -0
- package/app/components/preview/PreviewLoading.vue +5 -14
- package/app/components/preview/PreviewScreen.vue +64 -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 +68 -0
- package/app/components/site/SiteAsideOverlay.vue +21 -0
- package/app/components/site/SiteMain.vue +13 -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 -89
- package/app/composables/ads.ts +23 -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 +85 -71
- package/app/composables/loading.ts +2 -0
- package/app/composables/mainContent.ts +31 -0
- package/app/composables/og.ts +182 -0
- package/app/composables/phrases.ts +126 -81
- package/app/composables/preview.ts +53 -0
- package/app/composables/route.ts +4 -0
- package/app/composables/theme.ts +71 -29
- package/app/composables/url.ts +22 -33
- package/app/formatters/ru.ts +14 -0
- package/app/pages/article/[...articleId].vue +10 -1
- package/app/pages/book/[...bookId].vue +52 -43
- package/app/pages/contributor/[contributorId].vue +150 -0
- package/app/pages/contributors.vue +99 -0
- package/app/pages/group/[...groupId].vue +53 -59
- package/app/pages/index.vue +111 -26
- package/app/pages/page/[...pageId].vue +60 -0
- package/app/pages/practice/[...practiceId].vue +12 -0
- package/app/pages/sponsors.vue +91 -0
- 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 +40 -0
- package/app/router.options.ts +5 -0
- package/app/scripts/theme.js +33 -0
- package/app/styles/main.css +172 -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 +62 -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 -87
- package/package.json +38 -19
- 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 +61 -0
- package/server/api/contributor/page/[contributorId].ts +68 -0
- 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 +58 -0
- package/server/api/prerender/content.ts +82 -0
- package/server/api/prerender/default.ts +35 -0
- package/server/api/prerender/files.ts +10 -0
- package/server/api/prerender/frontNav.ts +13 -0
- package/server/api/prerender/language.ts +7 -0
- 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 +137 -0
- package/server/erudit/cameos/build.ts +161 -0
- package/server/erudit/config.ts +13 -0
- package/server/erudit/content/global/build.ts +297 -0
- package/server/erudit/content/global/singleton.ts +5 -0
- package/server/erudit/content/nav/build.ts +463 -0
- package/server/erudit/content/nav/front.ts +127 -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 +105 -0
- package/server/erudit/content/repository/externals.ts +50 -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 +290 -0
- package/server/erudit/content/resolve/page.ts +87 -0
- package/server/erudit/content/resolve/topic.ts +246 -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 +132 -0
- package/server/erudit/content/search.ts +163 -0
- package/server/erudit/contributors/build.ts +166 -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 +26 -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 +15 -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 +211 -0
- package/server/erudit/language/list/ru.ts +216 -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 +114 -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 +165 -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 +9 -0
- package/server/routes/search.json.gz.ts +73 -0
- package/server/routes/sitemap.xml.ts +81 -0
- 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 +14 -0
- package/shared/types/frontContentNav.ts +38 -0
- package/shared/types/indexPage.ts +20 -0
- package/shared/types/language.ts +191 -75
- 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/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/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/Loading.vue +0 -23
- package/app/components/SiteAside.vue +0 -393
- package/app/components/SiteMain.vue +0 -34
- package/app/components/ads/BannerTemplate.vue +0 -51
- package/app/components/ads/BottomBanner.vue +0 -45
- package/app/components/ads/LeftBanner.vue +0 -50
- 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 -34
- package/app/components/aside/major/panes/Search.vue +0 -11
- package/app/components/aside/major/panes/nav/Nav.vue +0 -87
- package/app/components/aside/major/panes/nav/NavBook.vue +0 -87
- 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 -15
- package/app/components/aside/major/panes/other/ItemTheme.vue +0 -54
- package/app/components/aside/major/panes/other/Other.vue +0 -16
- package/app/components/aside/minor/AsideMinorContributor.vue +0 -5
- package/app/components/aside/minor/AsideMinorNews.vue +0 -11
- package/app/components/aside/minor/AsideMinorTopLink.vue +0 -67
- package/app/components/aside/minor/Contribute.vue +0 -145
- package/app/components/aside/minor/content/AsideMinorContent.vue +0 -92
- package/app/components/aside/minor/topic/AsideMinorTopic.vue +0 -32
- package/app/components/aside/minor/topic/TopicContributors.vue +0 -177
- package/app/components/aside/minor/topic/TopicNav.vue +0 -49
- package/app/components/aside/minor/topic/TopicToc.vue +0 -219
- package/app/components/aside/minor/topic/TopicTocItem.vue +0 -30
- package/app/components/aside/utils/AsideOverlayPane.vue +0 -40
- package/app/components/bitran/BitranContent.vue +0 -77
- package/app/components/bitran/RenderWrapper.vue +0 -10
- package/app/components/contributor/ContributorAvatar.vue +0 -43
- package/app/components/contributor/ContributorListItem.vue +0 -35
- package/app/components/main/topic/MainTopic.vue +0 -78
- package/app/components/main/topic/TopicPartSwitch.vue +0 -118
- package/app/components/main/utils/Breadcrumb.vue +0 -70
- package/app/components/main/utils/ContentDecoration.vue +0 -29
- package/app/components/main/utils/ContentDescription.vue +0 -19
- package/app/components/main/utils/ContentPopover.vue +0 -188
- package/app/components/main/utils/ContentPopovers.vue +0 -111
- package/app/components/main/utils/ContentReferences.vue +0 -70
- package/app/components/main/utils/ContentSection.vue +0 -45
- package/app/components/main/utils/ContentTitle.vue +0 -63
- package/app/components/main/utils/reference/ReferenceGroup.vue +0 -38
- package/app/components/main/utils/reference/ReferenceItem.vue +0 -68
- package/app/components/main/utils/reference/ReferenceSource.vue +0 -116
- 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 -20
- package/app/components/preview/display/Unique.vue +0 -55
- package/app/composables/bitran.ts +0 -105
- package/app/composables/bitranContent.ts +0 -51
- package/app/composables/bitranLocation.ts +0 -7
- package/app/composables/contentData.ts +0 -36
- package/app/composables/contentPage.ts +0 -157
- package/app/composables/contentRoute.ts +0 -45
- package/app/composables/darkMagic.ts +0 -24
- package/app/composables/externalApi.ts +0 -63
- package/app/composables/majorPane.ts +0 -60
- package/app/pages/_test/preview.vue +0 -110
- package/app/pages/members.vue +0 -6
- package/app/pages/practice/[...practice].vue +0 -3
- 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/public/user.svg +0 -10
- 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/aside/minor/topic.ts +0 -3
- package/app/scripts/flag.ts +0 -28
- package/app/scripts/og.ts +0 -27
- package/app/scripts/preview/build.ts +0 -73
- 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 -22
- package/app/scripts/preview/data/unique.ts +0 -72
- 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 -63
- 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/globalPath.ts +0 -21
- package/globals/bitran.ts +0 -2
- package/globals/content.ts +0 -22
- package/globals/contributor.ts +0 -5
- package/globals/erudit.ts +0 -5
- package/globals/register.ts +0 -18
- package/languages/en.ts +0 -95
- package/languages/ru.ts +0 -99
- package/module/bitran.ts +0 -36
- package/module/config.ts +0 -35
- package/module/imports.ts +0 -50
- 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 -20
- package/server/api/aside/major/nav/global.ts +0 -7
- package/server/api/aside/minor/news.ts +0 -7
- package/server/api/aside/minor/path.ts +0 -77
- package/server/api/bitran/content/[location].ts +0 -8
- package/server/api/bitran/toc/[location].ts +0 -7
- package/server/api/content/data.ts +0 -72
- 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/language/phrase/[phraseId].ts +0 -19
- package/server/api/language/phraseIds.ts +0 -8
- package/server/api/preview/page/[...parts].ts +0 -52
- package/server/api/preview/unique/[location].ts +0 -60
- package/server/plugin/bitran/content.ts +0 -194
- package/server/plugin/bitran/location.ts +0 -25
- package/server/plugin/bitran/products/include.ts +0 -228
- package/server/plugin/bitran/products/link.ts +0 -116
- package/server/plugin/bitran/setup.ts +0 -11
- package/server/plugin/bitran/toc.ts +0 -75
- package/server/plugin/bitran/transpiler.ts +0 -30
- package/server/plugin/build/close.ts +0 -10
- package/server/plugin/build/jobs/content/builderArgs.ts +0 -8
- package/server/plugin/build/jobs/content/generic.ts +0 -176
- package/server/plugin/build/jobs/content/parse.ts +0 -109
- 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 -37
- package/server/plugin/build/jobs/content/type/topic.ts +0 -36
- package/server/plugin/build/jobs/contributors.ts +0 -66
- package/server/plugin/build/jobs/language.ts +0 -36
- package/server/plugin/build/jobs/nav.ts +0 -214
- package/server/plugin/build/process.ts +0 -25
- package/server/plugin/build/rebuild.ts +0 -55
- package/server/plugin/build/setup.ts +0 -22
- package/server/plugin/content/absoluteId.ts +0 -94
- 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 -49
- package/server/plugin/db/entities/Contribution.ts +0 -10
- package/server/plugin/db/entities/Contributor.ts +0 -16
- package/server/plugin/db/entities/Group.ts +0 -14
- package/server/plugin/db/entities/Hash.ts +0 -15
- package/server/plugin/db/entities/Topic.ts +0 -20
- package/server/plugin/db/entities/Unique.ts +0 -21
- package/server/plugin/db/setup.ts +0 -34
- package/server/plugin/global.ts +0 -17
- package/server/plugin/importer.ts +0 -12
- package/server/plugin/index.ts +0 -9
- package/server/plugin/logger.ts +0 -23
- package/server/plugin/nav/node.ts +0 -26
- package/server/plugin/nav/utils.ts +0 -129
- package/server/plugin/repository/book.ts +0 -21
- package/server/plugin/repository/content.ts +0 -238
- package/server/plugin/repository/contributor.ts +0 -8
- package/server/plugin/repository/frontNav.ts +0 -148
- package/server/plugin/repository/topic.ts +0 -32
- package/server/tsconfig.json +0 -9
- package/shared/aside/minor.ts +0 -51
- package/shared/asset.ts +0 -15
- package/shared/bitran/stringContent.ts +0 -6
- package/shared/bitran/toc.ts +0 -8
- package/shared/content/context.ts +0 -9
- package/shared/content/data/base.ts +0 -32
- package/shared/content/data/index.ts +0 -5
- package/shared/content/data/type/book.ts +0 -5
- package/shared/content/data/type/group.ts +0 -6
- package/shared/content/data/type/topic.ts +0 -11
- package/shared/content/previousNext.ts +0 -9
- package/shared/contributor.ts +0 -5
- package/shared/frontNav.ts +0 -41
- package/shared/icons.ts +0 -38
- package/shared/image.ts +0 -5
- package/shared/link.ts +0 -28
- package/shared/popover.ts +0 -8
- package/shared/utils/objectsEqual.ts +0 -4
- package/utils/stress.ts +0 -9
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import {
|
|
3
|
+
parseQuoteId,
|
|
4
|
+
type CameoQuote,
|
|
5
|
+
type Quote,
|
|
6
|
+
type SponsorQuote,
|
|
7
|
+
} from '@erudit-js/core/quote';
|
|
8
|
+
|
|
9
|
+
export default defineEventHandler<Promise<Quote>>(async (event) => {
|
|
10
|
+
const quoteId = event.context.params?.quoteId;
|
|
11
|
+
|
|
12
|
+
if (!quoteId) {
|
|
13
|
+
throw createError({
|
|
14
|
+
statusCode: 400,
|
|
15
|
+
message: 'Quote ID is required!',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { type, id } = parseQuoteId(quoteId);
|
|
20
|
+
|
|
21
|
+
if (type === 'cameo') {
|
|
22
|
+
const dbCameo = await ERUDIT.db.query.cameos.findFirst({
|
|
23
|
+
columns: { data: true },
|
|
24
|
+
where: eq(ERUDIT.db.schema.cameos.cameoId, id),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (!dbCameo) {
|
|
28
|
+
throw createError({
|
|
29
|
+
statusCode: 404,
|
|
30
|
+
message: `Failed to find cameo with ID "${id}"!`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const data = dbCameo.data;
|
|
35
|
+
|
|
36
|
+
const quote: CameoQuote = {
|
|
37
|
+
type: 'cameo',
|
|
38
|
+
name: data.name,
|
|
39
|
+
messages: data.messages,
|
|
40
|
+
icon: data.icon,
|
|
41
|
+
color: data.color,
|
|
42
|
+
link: data.link,
|
|
43
|
+
avatarUrl: `/file/cameos/${id}/avatar.${data.avatarExtension}`,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return quote;
|
|
47
|
+
} else if (type === 'sponsor') {
|
|
48
|
+
const dbSponsor = await ERUDIT.db.query.sponsors.findFirst({
|
|
49
|
+
columns: { data: true },
|
|
50
|
+
where: eq(ERUDIT.db.schema.sponsors.sponsorId, id),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (!dbSponsor) {
|
|
54
|
+
throw createError({
|
|
55
|
+
statusCode: 404,
|
|
56
|
+
message: `Failed to find cameo with ID "${id}"!`,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const data = dbSponsor.data;
|
|
61
|
+
|
|
62
|
+
const quote: SponsorQuote = {
|
|
63
|
+
type: 'sponsor',
|
|
64
|
+
name: data.name ?? id,
|
|
65
|
+
color: data.color,
|
|
66
|
+
icon: data.icon,
|
|
67
|
+
link: data.link,
|
|
68
|
+
avatarUrl: ERUDIT.repository.sponsors.avatarUrl(
|
|
69
|
+
id,
|
|
70
|
+
data.avatarExtension,
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
if (data.messages?.enabled === true) {
|
|
75
|
+
if (data.messages.list) {
|
|
76
|
+
quote.messages = data.messages.list;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return quote;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
throw createError({
|
|
84
|
+
statusCode: 400,
|
|
85
|
+
message: `Unable to resolve quote ID "${quoteId}"!`,
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import chokidar from 'chokidar';
|
|
3
|
+
import { debounce } from 'perfect-debounce';
|
|
4
|
+
import slash from 'slash';
|
|
5
|
+
|
|
6
|
+
// Builders
|
|
7
|
+
import { buildContributors } from './contributors/build';
|
|
8
|
+
import { buildSponsors } from './sponsors/build';
|
|
9
|
+
import { buildCameos } from './cameos/build';
|
|
10
|
+
import { buildContentNav } from './content/nav/build';
|
|
11
|
+
import { requestFullContentResolve, resolveContent } from './content/resolve';
|
|
12
|
+
import { buildGlobalContent } from './content/global/build';
|
|
13
|
+
import { buildNews } from './news/build';
|
|
14
|
+
|
|
15
|
+
export type EruditServerChangedFiles = Set<string>;
|
|
16
|
+
export type EruditServerBuildError = Error | undefined;
|
|
17
|
+
|
|
18
|
+
export async function buildServerErudit() {
|
|
19
|
+
ERUDIT.buildPromise = (async () => {
|
|
20
|
+
ERUDIT.buildError = undefined;
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
ERUDIT.log.start('Building...');
|
|
24
|
+
await buildContributors();
|
|
25
|
+
await buildSponsors();
|
|
26
|
+
await buildCameos();
|
|
27
|
+
await buildNews();
|
|
28
|
+
await buildContentNav();
|
|
29
|
+
await buildGlobalContent();
|
|
30
|
+
await resolveContent();
|
|
31
|
+
ERUDIT.log.success(chalk.green('Build Complete!'));
|
|
32
|
+
} catch (buildError) {
|
|
33
|
+
requestFullContentResolve();
|
|
34
|
+
|
|
35
|
+
if (buildError instanceof Error) {
|
|
36
|
+
ERUDIT.buildError = buildError;
|
|
37
|
+
if (buildError.stack) {
|
|
38
|
+
ERUDIT.log.error(buildError.stack);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
ERUDIT.buildError = createError({
|
|
42
|
+
statusCode: 500,
|
|
43
|
+
statusMessage: 'Unknown Erudit Build Error!',
|
|
44
|
+
message:
|
|
45
|
+
typeof buildError === 'string'
|
|
46
|
+
? buildError
|
|
47
|
+
: 'An unknown error occurred!',
|
|
48
|
+
});
|
|
49
|
+
ERUDIT.log.error(ERUDIT.buildError.message);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
await ERUDIT.buildPromise;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//
|
|
58
|
+
// Watcher
|
|
59
|
+
//
|
|
60
|
+
|
|
61
|
+
export async function tryServerWatchProject() {
|
|
62
|
+
if (
|
|
63
|
+
ERUDIT.config.public.mode !== 'write' &&
|
|
64
|
+
ERUDIT.config.public.mode !== 'dev'
|
|
65
|
+
) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let pendingRebuild = false;
|
|
70
|
+
ERUDIT.changedFiles = new Set<string>();
|
|
71
|
+
|
|
72
|
+
const tryRebuildErudit = debounce(async () => {
|
|
73
|
+
pendingRebuild = true;
|
|
74
|
+
try {
|
|
75
|
+
await ERUDIT.buildPromise;
|
|
76
|
+
const files = Array.from(ERUDIT.changedFiles);
|
|
77
|
+
console.log();
|
|
78
|
+
ERUDIT.log.warn(
|
|
79
|
+
`${chalk.yellow('Rebuilding due to file change(s):')}\n\n` +
|
|
80
|
+
files
|
|
81
|
+
.map((p, i) => chalk.gray(`${i + 1} -`) + ` "${p}"`)
|
|
82
|
+
.join('\n'),
|
|
83
|
+
);
|
|
84
|
+
console.log();
|
|
85
|
+
await buildServerErudit();
|
|
86
|
+
ERUDIT.changedFiles.clear();
|
|
87
|
+
} finally {
|
|
88
|
+
ERUDIT.changedFiles.clear();
|
|
89
|
+
pendingRebuild = false;
|
|
90
|
+
}
|
|
91
|
+
}, 300);
|
|
92
|
+
|
|
93
|
+
function isWatched(path: string) {
|
|
94
|
+
if (path.startsWith(ERUDIT.config.paths.project + '/content/')) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (path.startsWith(ERUDIT.config.paths.project + '/contributors/')) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (path.startsWith(ERUDIT.config.paths.project + '/cameos/')) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (path.startsWith(ERUDIT.config.paths.project + '/sponsors/')) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (path.startsWith(ERUDIT.config.paths.project + '/news/')) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const watcher = chokidar.watch(ERUDIT.config.paths.project, {
|
|
116
|
+
ignoreInitial: true,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
watcher.on('all', (_, path) => {
|
|
120
|
+
path = slash(path);
|
|
121
|
+
|
|
122
|
+
if (!isWatched(path)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (pendingRebuild) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (path.trim()) {
|
|
131
|
+
ERUDIT.changedFiles.add(String(path));
|
|
132
|
+
tryRebuildErudit();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
ERUDIT.log.success('Server project watcher is active 👀');
|
|
137
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { readdirSync, readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { eq } from 'drizzle-orm';
|
|
3
|
+
import type { Cameo, CameoConfig } from '@erudit-js/core/cameo';
|
|
4
|
+
|
|
5
|
+
let initialBuild = true;
|
|
6
|
+
|
|
7
|
+
const cameosRoot = () => `${ERUDIT.config.paths.project}/cameos`;
|
|
8
|
+
|
|
9
|
+
export async function buildCameos() {
|
|
10
|
+
ERUDIT.log.debug.start('Building cameos...');
|
|
11
|
+
|
|
12
|
+
const isInitial = initialBuild;
|
|
13
|
+
initialBuild = false;
|
|
14
|
+
|
|
15
|
+
const cameoIds = collectCameoIds(isInitial);
|
|
16
|
+
|
|
17
|
+
if (!cameoIds.size) {
|
|
18
|
+
ERUDIT.log.info(
|
|
19
|
+
isInitial
|
|
20
|
+
? 'Skipping cameos — no cameos found.'
|
|
21
|
+
: 'Skipping cameos — nothing changed.',
|
|
22
|
+
);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (const cameoId of cameoIds) {
|
|
27
|
+
await cleanupCameo(cameoId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const existingIds = [...cameoIds].filter((id) =>
|
|
31
|
+
existsSync(`${cameosRoot()}/${id}`),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
if (!existingIds.length) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const cameoId of existingIds) {
|
|
39
|
+
await buildCameo(cameoId);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ERUDIT.log.success(
|
|
43
|
+
isInitial
|
|
44
|
+
? `Cameos build complete! (${ERUDIT.log.stress(cameoIds.size)})`
|
|
45
|
+
: `Cameos updated: ${ERUDIT.log.stress(existingIds.join(', '))}`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//
|
|
50
|
+
//
|
|
51
|
+
//
|
|
52
|
+
|
|
53
|
+
function collectCameoIds(initial: boolean): Set<string> {
|
|
54
|
+
if (initial) {
|
|
55
|
+
try {
|
|
56
|
+
return new Set(
|
|
57
|
+
readdirSync(cameosRoot(), { withFileTypes: true })
|
|
58
|
+
.filter((entry) => entry.isDirectory())
|
|
59
|
+
.map((entry) => entry.name),
|
|
60
|
+
);
|
|
61
|
+
} catch {
|
|
62
|
+
return new Set();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const ids = new Set<string>();
|
|
67
|
+
|
|
68
|
+
for (const file of ERUDIT.changedFiles.values()) {
|
|
69
|
+
if (!file.startsWith(`${cameosRoot()}/`)) continue;
|
|
70
|
+
const id = file.replace(`${cameosRoot()}/`, '').split('/')[0];
|
|
71
|
+
if (id) ids.add(id);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return ids;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function cleanupCameo(cameoId: string) {
|
|
78
|
+
await ERUDIT.db
|
|
79
|
+
.delete(ERUDIT.db.schema.cameos)
|
|
80
|
+
.where(eq(ERUDIT.db.schema.cameos.cameoId, cameoId));
|
|
81
|
+
|
|
82
|
+
await ERUDIT.db
|
|
83
|
+
.delete(ERUDIT.db.schema.files)
|
|
84
|
+
.where(eq(ERUDIT.db.schema.files.role, 'cameo-avatar'));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function buildCameo(cameoId: string) {
|
|
88
|
+
ERUDIT.log.debug.start(`Building cameo ${ERUDIT.log.stress(cameoId)}...`);
|
|
89
|
+
|
|
90
|
+
const dir = `${cameosRoot()}/${cameoId}`;
|
|
91
|
+
const files = readdirSync(dir);
|
|
92
|
+
|
|
93
|
+
const hasConfig = files.some(
|
|
94
|
+
(file) => file === 'cameo.ts' || file === 'cameo.js',
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
if (!hasConfig) {
|
|
98
|
+
ERUDIT.log.error(
|
|
99
|
+
`No config file found for cameo ${ERUDIT.log.stress(cameoId)}!`,
|
|
100
|
+
);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let cameoConfig: CameoConfig;
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
cameoConfig = (await ERUDIT.import(`${dir}/cameo`)) as CameoConfig;
|
|
108
|
+
} catch (error) {
|
|
109
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
110
|
+
ERUDIT.log.error(
|
|
111
|
+
`Failed to load config for cameo ${ERUDIT.log.stress(cameoId)}: ${message}`,
|
|
112
|
+
);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const avatarExtension = files
|
|
117
|
+
.find((file) => file.startsWith('avatar.'))
|
|
118
|
+
?.split('.')
|
|
119
|
+
.pop();
|
|
120
|
+
|
|
121
|
+
if (!avatarExtension) {
|
|
122
|
+
ERUDIT.log.error(
|
|
123
|
+
`No avatar file found for cameo ${ERUDIT.log.stress(cameoId)}!`,
|
|
124
|
+
);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
await ERUDIT.repository.db.pushFile(
|
|
129
|
+
`${dir}/avatar.${avatarExtension}`,
|
|
130
|
+
'cameo-avatar',
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const icon = (() => {
|
|
134
|
+
const iconFile = files.find((file) => file === 'icon.svg');
|
|
135
|
+
if (iconFile) {
|
|
136
|
+
return readFileSync(dir + '/' + iconFile, 'utf-8');
|
|
137
|
+
}
|
|
138
|
+
})();
|
|
139
|
+
|
|
140
|
+
if (!icon) {
|
|
141
|
+
ERUDIT.log.error(
|
|
142
|
+
`No icon file found for cameo ${ERUDIT.log.stress(cameoId)}!`,
|
|
143
|
+
);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const cameo: Cameo = {
|
|
148
|
+
cameoId,
|
|
149
|
+
name: cameoConfig.name,
|
|
150
|
+
icon,
|
|
151
|
+
avatarExtension,
|
|
152
|
+
color: cameoConfig.color,
|
|
153
|
+
link: cameoConfig.link,
|
|
154
|
+
messages: cameoConfig.messages,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
await ERUDIT.db.insert(ERUDIT.db.schema.cameos).values({
|
|
158
|
+
cameoId: cameoId,
|
|
159
|
+
data: cameo,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type EruditServerConfig = EruditRuntimeConfig & {
|
|
2
|
+
public: EruditPublicRuntimeConfig;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export async function setupServerRuntimeConfig() {
|
|
6
|
+
const runtimeConfig = useRuntimeConfig();
|
|
7
|
+
ERUDIT.config = {
|
|
8
|
+
...runtimeConfig.erudit,
|
|
9
|
+
public: {
|
|
10
|
+
...runtimeConfig.public.erudit,
|
|
11
|
+
},
|
|
12
|
+
} as EruditServerConfig;
|
|
13
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { topicParts, type TopicPart } from '@erudit-js/core/content/topic';
|
|
3
|
+
import { $CONTENT } from './singleton';
|
|
4
|
+
|
|
5
|
+
// Call singleton to trigger initialization
|
|
6
|
+
$CONTENT;
|
|
7
|
+
|
|
8
|
+
let initialBuild = true;
|
|
9
|
+
|
|
10
|
+
const contentRoot = () => `${ERUDIT.config.paths.project}/content`;
|
|
11
|
+
|
|
12
|
+
export async function buildGlobalContent() {
|
|
13
|
+
ERUDIT.log.debug.start('Building global content...');
|
|
14
|
+
|
|
15
|
+
const isInitial = initialBuild;
|
|
16
|
+
initialBuild = false;
|
|
17
|
+
|
|
18
|
+
if (!isInitial && !hasContentChanges()) {
|
|
19
|
+
ERUDIT.log.info('Skipping global content — nothing changed.');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const linkObject = await buildLinkObject();
|
|
24
|
+
|
|
25
|
+
const linkTypes = linkObjectToTypes(linkObject);
|
|
26
|
+
writeFileSync(
|
|
27
|
+
ERUDIT.config.paths.build + '/types/content.d.ts',
|
|
28
|
+
linkTypes,
|
|
29
|
+
'utf-8',
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
ERUDIT.log.success(
|
|
33
|
+
isInitial
|
|
34
|
+
? 'Global content build complete!'
|
|
35
|
+
: 'Global content updated!',
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function hasContentChanges() {
|
|
40
|
+
for (const file of (ERUDIT.changedFiles || new Set<string>()).values()) {
|
|
41
|
+
if (file.startsWith(`${contentRoot()}/`)) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function linkObjectToTypes(linkObject: any): string {
|
|
50
|
+
const indent = (level: number) => ' '.repeat(level);
|
|
51
|
+
|
|
52
|
+
function toCamelCase(str: string): string {
|
|
53
|
+
return str.replace(/[-_](.)/g, (_, char) => char.toUpperCase());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function processObject(obj: any, level: number): string {
|
|
57
|
+
const lines: string[] = [];
|
|
58
|
+
|
|
59
|
+
for (const [key, value] of Object.entries(obj) as [string, any][]) {
|
|
60
|
+
if (key === '__jsdoc' || key === '__typeguard') continue;
|
|
61
|
+
|
|
62
|
+
const camelKey = toCamelCase(key);
|
|
63
|
+
|
|
64
|
+
// Add JSDoc comment if present
|
|
65
|
+
if (value && typeof value === 'object' && value.__jsdoc) {
|
|
66
|
+
const jsdocLines = value.__jsdoc.split('\n');
|
|
67
|
+
jsdocLines.forEach((line: string) => {
|
|
68
|
+
lines.push(indent(level) + line);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Determine if value has nested properties (excluding __jsdoc and __typeguard)
|
|
73
|
+
const hasNestedProps =
|
|
74
|
+
value &&
|
|
75
|
+
typeof value === 'object' &&
|
|
76
|
+
Object.keys(value).some(
|
|
77
|
+
(k) => k !== '__jsdoc' && k !== '__typeguard',
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// Get the typeguard from the object, default to GlobalContentItemTypeguard
|
|
81
|
+
const typeguard =
|
|
82
|
+
value?.__typeguard || 'GlobalContentItemTypeguard';
|
|
83
|
+
|
|
84
|
+
if (hasNestedProps) {
|
|
85
|
+
lines.push(indent(level) + `${camelKey}: ${typeguard} & {`);
|
|
86
|
+
lines.push(processObject(value, level + 1));
|
|
87
|
+
lines.push(indent(level) + `}`);
|
|
88
|
+
} else {
|
|
89
|
+
lines.push(indent(level) + `${camelKey}: ${typeguard} & {}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return lines.join('\n');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const body = processObject(linkObject, 2);
|
|
97
|
+
|
|
98
|
+
return `import type {
|
|
99
|
+
GlobalContentItemTypeguard,
|
|
100
|
+
GlobalContentTopicPartTypeguard,
|
|
101
|
+
GlobalContentUniqueTypeguard,
|
|
102
|
+
} from '@erudit-js/core/content/global';
|
|
103
|
+
|
|
104
|
+
export {};
|
|
105
|
+
|
|
106
|
+
declare global {
|
|
107
|
+
const $CONTENT: {
|
|
108
|
+
${body}
|
|
109
|
+
}
|
|
110
|
+
}`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Loop through the content navigation tree and build a nested object representing the link structure:
|
|
115
|
+
*/
|
|
116
|
+
async function buildLinkObject() {
|
|
117
|
+
const linkTree: any = {};
|
|
118
|
+
|
|
119
|
+
await ERUDIT.contentNav.walk((navItem) => {
|
|
120
|
+
// Navigate to the correct position in the tree based on the full path
|
|
121
|
+
let cursor = linkTree;
|
|
122
|
+
const pathParts = navItem.fullId.split('/');
|
|
123
|
+
|
|
124
|
+
// Navigate through parent parts
|
|
125
|
+
for (let i = 0; i < pathParts.length - 1; i++) {
|
|
126
|
+
cursor = cursor[pathParts[i]];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
//
|
|
130
|
+
//
|
|
131
|
+
//
|
|
132
|
+
|
|
133
|
+
if (navItem.type === 'page') {
|
|
134
|
+
const pathToFile = `${ERUDIT.config.paths.project}/content/${navItem.contentRelPath}/${navItem.type}.tsx`;
|
|
135
|
+
const moduleContent = readFileSync(pathToFile, 'utf-8');
|
|
136
|
+
const title = tryGetTitle(moduleContent);
|
|
137
|
+
|
|
138
|
+
const jsdoc = jsdocLines([
|
|
139
|
+
title ? `Title: ${title}` : undefined,
|
|
140
|
+
`Type: ${navItem.type}`,
|
|
141
|
+
`Location: [${navItem.contentRelPath}](file:///${pathToFile})`,
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
cursor[navItem.idPart] = {
|
|
145
|
+
__typeguard: 'GlobalContentItemTypeguard',
|
|
146
|
+
__jsdoc: `
|
|
147
|
+
/**
|
|
148
|
+
${jsdoc}
|
|
149
|
+
*/
|
|
150
|
+
`.trim(),
|
|
151
|
+
...tryGetUniquesObject(
|
|
152
|
+
moduleContent,
|
|
153
|
+
pathToFile,
|
|
154
|
+
navItem.contentRelPath,
|
|
155
|
+
),
|
|
156
|
+
};
|
|
157
|
+
} else if (navItem.type === 'topic') {
|
|
158
|
+
const pathToTopicFile = `${ERUDIT.config.paths.project}/content/${navItem.contentRelPath}/topic.ts`;
|
|
159
|
+
const topicModuleContent = readFileSync(pathToTopicFile, 'utf-8');
|
|
160
|
+
const title = tryGetTitle(topicModuleContent);
|
|
161
|
+
|
|
162
|
+
const jsdoc = jsdocLines([
|
|
163
|
+
title ? `Title: ${title}` : undefined,
|
|
164
|
+
`Type: topic`,
|
|
165
|
+
`Location: [${navItem.contentRelPath}](file:///${pathToTopicFile})`,
|
|
166
|
+
]);
|
|
167
|
+
|
|
168
|
+
cursor[navItem.idPart] = {
|
|
169
|
+
__typeguard: 'GlobalContentItemTypeguard',
|
|
170
|
+
__jsdoc: `
|
|
171
|
+
/**
|
|
172
|
+
${jsdoc}
|
|
173
|
+
*/
|
|
174
|
+
`.trim(),
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
for (const part of topicParts) {
|
|
178
|
+
try {
|
|
179
|
+
const pathToFile = `${ERUDIT.config.paths.project}/content/${navItem.contentRelPath}/${part}.tsx`;
|
|
180
|
+
const partContent = readFileSync(pathToFile, 'utf-8');
|
|
181
|
+
|
|
182
|
+
const jsdoc = jsdocLines([
|
|
183
|
+
title ? `Title: ${title}` : undefined,
|
|
184
|
+
`Type: topic`,
|
|
185
|
+
`Part: ${part}`,
|
|
186
|
+
`Location: [${navItem.contentRelPath}](file:///${pathToFile})`,
|
|
187
|
+
]);
|
|
188
|
+
|
|
189
|
+
cursor[navItem.idPart][part as TopicPart] = {
|
|
190
|
+
__typeguard: 'GlobalContentTopicPartTypeguard',
|
|
191
|
+
__jsdoc: `
|
|
192
|
+
/**
|
|
193
|
+
${jsdoc}
|
|
194
|
+
*/
|
|
195
|
+
`.trim(),
|
|
196
|
+
...tryGetUniquesObject(
|
|
197
|
+
partContent,
|
|
198
|
+
pathToFile,
|
|
199
|
+
navItem.contentRelPath,
|
|
200
|
+
),
|
|
201
|
+
};
|
|
202
|
+
} catch {}
|
|
203
|
+
}
|
|
204
|
+
} else {
|
|
205
|
+
const pathToFile = `${ERUDIT.config.paths.project}/content/${navItem.contentRelPath}/${navItem.type}.ts`;
|
|
206
|
+
const moduleContent = readFileSync(pathToFile, 'utf-8');
|
|
207
|
+
const title = tryGetTitle(moduleContent);
|
|
208
|
+
|
|
209
|
+
const jsdoc = jsdocLines([
|
|
210
|
+
title ? `Title: ${title}` : undefined,
|
|
211
|
+
`Type: ${navItem.type}`,
|
|
212
|
+
`Location: [${navItem.contentRelPath}](file:///${pathToFile})`,
|
|
213
|
+
]);
|
|
214
|
+
|
|
215
|
+
cursor[navItem.idPart] = {
|
|
216
|
+
__typeguard: 'GlobalContentItemTypeguard',
|
|
217
|
+
__jsdoc: `
|
|
218
|
+
/**
|
|
219
|
+
${jsdoc}
|
|
220
|
+
*/
|
|
221
|
+
`.trim(),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return linkTree;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function tryGetTitle(moduleContent: string) {
|
|
230
|
+
const titleMatch = moduleContent.match(/title:\s*['"`](.*?)['"`]/);
|
|
231
|
+
|
|
232
|
+
if (titleMatch) {
|
|
233
|
+
return titleMatch[1].trim();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function jsdocLines(lines: any[]) {
|
|
238
|
+
return lines
|
|
239
|
+
.filter(Boolean)
|
|
240
|
+
.map((line) => ` * * ${line}`)
|
|
241
|
+
.join('\n');
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function tryGetUniquesObject(
|
|
245
|
+
moduleContent: string,
|
|
246
|
+
pathToFile: string,
|
|
247
|
+
pathInContent: string,
|
|
248
|
+
) {
|
|
249
|
+
// Match uniques: { ... } object (single or multiline)
|
|
250
|
+
const uniquesMatch = moduleContent.match(/uniques:\s*\{([^}]*)\}/s);
|
|
251
|
+
|
|
252
|
+
if (!uniquesMatch) {
|
|
253
|
+
return {};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const uniquesContent = uniquesMatch[1];
|
|
257
|
+
|
|
258
|
+
// Parse key-value pairs from uniques object
|
|
259
|
+
const lines = uniquesContent.split('\n');
|
|
260
|
+
const result: any = {};
|
|
261
|
+
|
|
262
|
+
for (const line of lines) {
|
|
263
|
+
// Skip commented out lines
|
|
264
|
+
if (line.trim().startsWith('//')) {
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Skip uniques starting with underscore
|
|
269
|
+
if (line.trim().startsWith('_')) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const pairMatch = line.match(/(\w+):\s*(\w+)/);
|
|
274
|
+
if (!pairMatch) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const [, uniqueName, tagName] = pairMatch;
|
|
279
|
+
|
|
280
|
+
const jsdoc = jsdocLines([
|
|
281
|
+
'Unique',
|
|
282
|
+
`Tag: \`<${tagName}>\``,
|
|
283
|
+
`Location: [${pathInContent}](file:///${pathToFile})`,
|
|
284
|
+
]);
|
|
285
|
+
|
|
286
|
+
result[`$${uniqueName}`] = {
|
|
287
|
+
__typeguard: 'GlobalContentUniqueTypeguard',
|
|
288
|
+
__jsdoc: `
|
|
289
|
+
/**
|
|
290
|
+
${jsdoc}
|
|
291
|
+
*/
|
|
292
|
+
`.trim(),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return result;
|
|
297
|
+
}
|