@fecommunity/reactpress 4.0.0-beta.1 → 4.0.0-beta.10
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/dist/utils/server-bundle.js +7 -0
- package/out/bin/reactpress-theme-client.js +64 -1
- package/out/bin/reactpress.js +94 -514
- package/out/core/services/config.js +4 -1
- package/out/core/services/database/index.js +18 -5
- package/out/core/services/database/sqlite.js +28 -5
- package/out/core/services/init.js +1 -53
- package/out/core/services/local-site.js +15 -10
- package/out/core/services/theme-bootstrap.js +50 -0
- package/out/core/utils/env-file.js +99 -0
- package/out/core/utils/paths.js +5 -4
- package/out/lib/api-dev.js +11 -1
- package/out/lib/bootstrap.js +13 -40
- package/out/lib/cli-events.js +54 -0
- package/out/lib/command-palette.js +53 -0
- package/out/lib/context-status.js +154 -0
- package/out/lib/create-site.js +187 -0
- package/out/lib/database-mode.js +45 -0
- package/out/lib/design-tokens.js +55 -0
- package/out/lib/dev-banner.js +10 -5
- package/out/lib/dev-session.js +9 -2
- package/out/lib/dev.js +68 -25
- package/out/lib/docker.js +12 -0
- package/out/lib/doctor.js +131 -10
- package/out/lib/http.js +20 -0
- package/out/lib/i18n/index.js +5 -1
- package/out/lib/i18n/strings.js +161 -81
- package/out/lib/lifecycle.js +21 -1
- package/out/lib/menu-actions.js +418 -0
- package/out/lib/nginx.js +5 -2
- package/out/lib/paths.js +11 -0
- package/out/lib/pm2.js +9 -2
- package/out/lib/ports.js +134 -13
- package/out/lib/publish.js +3 -0
- package/out/lib/remote-dev.js +5 -1
- package/out/lib/server-bundle.js +84 -0
- package/out/lib/shell-mode.js +23 -0
- package/out/lib/theme-warmup.js +1 -1
- package/out/shell/app.js +384 -0
- package/out/shell/components/brand-banner.js +93 -0
- package/out/shell/components/command-palette.js +77 -0
- package/out/shell/components/dev-stepper.js +54 -0
- package/out/shell/components/ink-theme.js +86 -0
- package/out/shell/components/menu-list.js +49 -0
- package/out/shell/components/pulse-bar.js +55 -0
- package/out/shell/components/status-rack.js +47 -0
- package/out/shell/hooks/use-terminal-size.js +27 -0
- package/out/shell/ink-shell.mjs +12056 -0
- package/out/shell/lib/shell-layout.js +60 -0
- package/out/shell/runtime/render-ink.js +89 -0
- package/out/ui/banner-startup.js +117 -0
- package/out/ui/banner.js +404 -277
- package/out/ui/interactive.js +149 -125
- package/out/ui/startup-splash.js +185 -0
- package/out/ui/theme.js +62 -10
- package/package.json +5 -3
- package/server/bin/reactpress-server.js +10 -2
- package/server/dist/app.module.js +13 -25
- package/server/dist/filters/http-exception.filter.js +1 -1
- package/server/dist/generate-swagger.js +12 -11
- package/server/dist/interceptors/transform.interceptor.js +10 -5
- package/server/dist/logger/index.js +5 -4
- package/server/dist/main.js +45 -23
- package/server/dist/modules/article/article.controller.js +103 -48
- package/server/dist/modules/article/article.entity.js +61 -41
- package/server/dist/modules/article/article.module.js +18 -3
- package/server/dist/modules/article/article.service.js +151 -29
- package/server/dist/modules/auth/auth.controller.js +11 -11
- package/server/dist/modules/auth/auth.module.js +4 -4
- package/server/dist/modules/auth/auth.service.js +8 -7
- package/server/dist/modules/auth/jwt-auth.guard.js +4 -3
- package/server/dist/modules/auth/jwt.strategy.js +4 -3
- package/server/dist/modules/auth/roles.guard.js +2 -2
- package/server/dist/modules/category/category.controller.js +21 -20
- package/server/dist/modules/category/category.entity.js +13 -13
- package/server/dist/modules/category/category.module.js +1 -1
- package/server/dist/modules/category/category.service.js +5 -4
- package/server/dist/modules/comment/comment.controller.js +24 -20
- package/server/dist/modules/comment/comment.entity.js +31 -31
- package/server/dist/modules/comment/comment.module.js +11 -2
- package/server/dist/modules/comment/comment.service.js +43 -16
- package/server/dist/modules/comment/html.js +3 -3
- package/server/dist/modules/file/file.controller.js +22 -20
- package/server/dist/modules/file/file.entity.js +20 -15
- package/server/dist/modules/file/file.module.js +16 -4
- package/server/dist/modules/file/file.service.js +70 -24
- package/server/dist/modules/install/install.controller.js +5 -5
- package/server/dist/modules/install/install.module.js +1 -1
- package/server/dist/modules/install/install.service.js +2 -2
- package/server/dist/modules/knowledge/knowledge.controller.js +35 -33
- package/server/dist/modules/knowledge/knowledge.entity.js +33 -33
- package/server/dist/modules/knowledge/knowledge.module.js +1 -1
- package/server/dist/modules/knowledge/knowledge.service.js +12 -11
- package/server/dist/modules/page/page.controller.js +24 -23
- package/server/dist/modules/page/page.entity.js +27 -27
- package/server/dist/modules/page/page.module.js +1 -1
- package/server/dist/modules/page/page.service.js +12 -12
- package/server/dist/modules/search/search.controller.js +12 -12
- package/server/dist/modules/search/search.entity.js +13 -13
- package/server/dist/modules/search/search.module.js +1 -1
- package/server/dist/modules/search/search.service.js +2 -2
- package/server/dist/modules/setting/setting.constant.js +3 -19
- package/server/dist/modules/setting/setting.controller.js +11 -11
- package/server/dist/modules/setting/setting.entity.js +64 -49
- package/server/dist/modules/setting/setting.module.js +2 -2
- package/server/dist/modules/setting/setting.service.js +169 -24
- package/server/dist/modules/smtp/mail.util.js +5 -9
- package/server/dist/modules/smtp/smtp.controller.js +27 -14
- package/server/dist/modules/smtp/smtp.entity.js +15 -15
- package/server/dist/modules/smtp/smtp.module.js +2 -2
- package/server/dist/modules/smtp/smtp.service.js +40 -12
- package/server/dist/modules/tag/tag.controller.js +24 -22
- package/server/dist/modules/tag/tag.entity.js +12 -12
- package/server/dist/modules/tag/tag.module.js +1 -1
- package/server/dist/modules/tag/tag.service.js +5 -4
- package/server/dist/modules/user/user.controller.js +39 -28
- package/server/dist/modules/user/user.entity.js +22 -22
- package/server/dist/modules/user/user.module.js +2 -2
- package/server/dist/modules/user/user.service.js +16 -12
- package/server/dist/modules/view/view.controller.js +20 -19
- package/server/dist/modules/view/view.entity.js +24 -24
- package/server/dist/modules/view/view.module.js +1 -1
- package/server/dist/modules/view/view.service.js +4 -4
- package/server/dist/starter.js +202 -14
- package/server/dist/utils/date.util.js +1 -1
- package/server/dist/utils/markdown.util.js +1 -1
- package/server/dist/utils/oss/aliyun-oss-client.js +5 -0
- package/server/dist/utils/oss.util.js +6 -1
- package/server/dist/utils/theme-placeholder-cover.js +94 -0
- package/server/dist/utils/uniqueid.util.js +1 -1
- package/server/dist/utils/upload.util.js +23 -8
- package/server/dist/utils/user.util.js +6 -2
- package/server/package-lock.json +21077 -0
- package/server/package.json +13 -10
- package/server/public/favicon.png +0 -0
- package/templates/config.local.json +1 -1
- package/templates/env.local.default +1 -1
- package/toolkit/dist/.source-fingerprint-toolkit +1 -0
- package/toolkit/dist/admin/index.js +18 -0
- package/toolkit/dist/admin/permissions.js +33 -0
- package/toolkit/dist/admin/registry.js +79 -0
- package/toolkit/dist/api/Article.js +188 -0
- package/toolkit/dist/api/Auth.js +58 -0
- package/toolkit/dist/api/Category.js +84 -0
- package/toolkit/dist/api/Comment.js +97 -0
- package/toolkit/dist/api/File.js +71 -0
- package/toolkit/dist/api/HttpClient.js +96 -0
- package/toolkit/dist/api/Knowledge.js +123 -0
- package/toolkit/dist/api/Page.js +97 -0
- package/toolkit/dist/api/Search.js +58 -0
- package/toolkit/dist/api/Setting.js +45 -0
- package/toolkit/dist/api/Smtp.js +73 -0
- package/toolkit/dist/api/Tag.js +97 -0
- package/toolkit/dist/api/User.js +72 -0
- package/toolkit/dist/api/View.js +84 -0
- package/toolkit/dist/api/index.js +30 -0
- package/toolkit/dist/api/instance.js +71 -0
- package/toolkit/dist/app/createReactPressApp.js +265 -0
- package/toolkit/dist/app/createThemeApp.js +51 -0
- package/toolkit/dist/app/devChunkRecovery.js +68 -0
- package/toolkit/dist/app/index.js +11 -0
- package/toolkit/dist/config/env.js +103 -0
- package/toolkit/dist/config/global.js +396 -0
- package/toolkit/dist/config/i18n.js +59 -0
- package/toolkit/dist/config/index.js +26 -0
- package/toolkit/dist/config/locales/en.json +125 -0
- package/toolkit/dist/config/locales/zh.json +125 -0
- package/toolkit/dist/dev/index.js +12 -0
- package/toolkit/dist/dev/portRedirect.js +93 -0
- package/toolkit/dist/dev/vitePortRedirectPlugin.js +40 -0
- package/toolkit/dist/extension/branding-mods.js +65 -0
- package/toolkit/dist/extension/configuration/defaults.js +32 -0
- package/toolkit/dist/extension/configuration/formily.js +170 -0
- package/toolkit/dist/extension/configuration/index.js +28 -0
- package/toolkit/dist/extension/configuration/paths.js +50 -0
- package/toolkit/dist/extension/configuration/presets/twentytwentyfive.js +94 -0
- package/toolkit/dist/extension/configuration/resolve.js +98 -0
- package/toolkit/dist/extension/configuration/types.js +3 -0
- package/toolkit/dist/extension/configuration/validate.js +21 -0
- package/toolkit/dist/extension/index.js +35 -0
- package/toolkit/dist/extension/manifest-normalize.js +75 -0
- package/toolkit/dist/extension/node.js +6 -0
- package/toolkit/dist/extension/presets/twentytwentyfive-appearance.js +193 -0
- package/toolkit/dist/extension/presets/twentytwentyfive-customizer.js +199 -0
- package/toolkit/dist/extension/preview.js +92 -0
- package/toolkit/dist/extension/site-notices.js +88 -0
- package/toolkit/dist/extension/site-settings.js +144 -0
- package/toolkit/dist/extension/theme-admin-locale.io.js +54 -0
- package/toolkit/dist/extension/theme-admin-locale.js +81 -0
- package/toolkit/dist/extension/theme.js +93 -0
- package/toolkit/dist/extension/twentytwentyfive-vars.js +100 -0
- package/toolkit/dist/index.js +60 -0
- package/toolkit/dist/plugin/admin/index.js +20 -0
- package/toolkit/dist/plugin/admin/permissions.js +33 -0
- package/toolkit/dist/plugin/admin/plugin-admin.js +41 -0
- package/toolkit/dist/plugin/admin/registry.js +79 -0
- package/toolkit/dist/plugin/admin/slots.js +16 -0
- package/toolkit/dist/plugin/client/client.js +95 -0
- package/toolkit/dist/plugin/client/index.js +11 -0
- package/toolkit/dist/plugin/client/runtime.js +30 -0
- package/toolkit/dist/plugin/dev/index.js +16 -0
- package/toolkit/dist/plugin/dev/portRedirect.js +111 -0
- package/toolkit/dist/plugin/dev/vitePortRedirectPlugin.js +40 -0
- package/toolkit/dist/plugin/extension/index.js +20 -0
- package/toolkit/dist/plugin/extension/plugin-admin-locale.io.js +54 -0
- package/toolkit/dist/plugin/extension/plugin-admin-locale.js +60 -0
- package/toolkit/dist/plugin/extension/plugin.js +146 -0
- package/toolkit/dist/plugin/extension/security.js +74 -0
- package/toolkit/dist/plugin/extension/validate.js +55 -0
- package/toolkit/dist/plugin/index.js +52 -0
- package/toolkit/dist/plugin/node.js +6 -0
- package/toolkit/dist/plugin/react/client.js +95 -0
- package/toolkit/dist/plugin/react/index.js +19 -0
- package/toolkit/dist/plugin/react/plugin-admin-ui.js +38 -0
- package/toolkit/dist/plugin/react/runtime.js +30 -0
- package/toolkit/dist/plugin/server/hook-reject.js +39 -0
- package/toolkit/dist/plugin/server/index.js +18 -0
- package/toolkit/dist/plugin/server/types.js +3 -0
- package/toolkit/dist/primitives/AntdStyleTransitionFix.js +16 -0
- package/toolkit/dist/primitives/Badge.js +9 -0
- package/toolkit/dist/primitives/Button.js +38 -0
- package/toolkit/dist/primitives/ColorModeToggle.js +13 -0
- package/toolkit/dist/primitives/IconButton.js +13 -0
- package/toolkit/dist/primitives/ScrollToTarget.js +48 -0
- package/toolkit/dist/primitives/Separator.js +9 -0
- package/toolkit/dist/primitives/Skeleton.js +9 -0
- package/toolkit/dist/primitives/Slot.js +25 -0
- package/toolkit/dist/primitives/Spinner.js +9 -0
- package/toolkit/dist/primitives/animation/ConditionTransition.js +13 -0
- package/toolkit/dist/primitives/animation/ListTrail.js +14 -0
- package/toolkit/dist/primitives/animation/Opacity.js +10 -0
- package/toolkit/dist/primitives/animation/Spring.js +29 -0
- package/toolkit/dist/primitives/animation/index.js +11 -0
- package/toolkit/dist/primitives/cn.js +7 -0
- package/toolkit/dist/primitives/icons.js +15 -0
- package/toolkit/dist/primitives/index.js +44 -0
- package/toolkit/dist/react/client.js +95 -0
- package/toolkit/dist/react/index.js +11 -0
- package/toolkit/dist/react/runtime.js +30 -0
- package/toolkit/dist/theme/antdDocument.js +59 -0
- package/toolkit/dist/theme/api/api-data.js +8 -0
- package/toolkit/dist/theme/api/api.js +27 -0
- package/toolkit/dist/theme/api/httpClient.js +83 -0
- package/toolkit/dist/theme/api/json.js +5 -0
- package/toolkit/dist/theme/api/jsonp.js +5 -0
- package/toolkit/dist/theme/api-data.js +22 -0
- package/toolkit/dist/theme/api.js +27 -0
- package/toolkit/dist/theme/appearance.js +16 -0
- package/toolkit/dist/theme/assets.js +27 -0
- package/toolkit/dist/theme/authSession.js +92 -0
- package/toolkit/dist/theme/build/antdDocument.js +70 -0
- package/toolkit/dist/theme/build/next-config.js +63 -0
- package/toolkit/dist/theme/build/node.js +6 -0
- package/toolkit/dist/theme/colorMode.js +45 -0
- package/toolkit/dist/theme/commentAuthor.js +48 -0
- package/toolkit/dist/theme/content/archiveSlim.js +38 -0
- package/toolkit/dist/theme/content/articleSlim.js +35 -0
- package/toolkit/dist/theme/content/assets.js +106 -0
- package/toolkit/dist/theme/content/carouselArticles.js +39 -0
- package/toolkit/dist/theme/content/excerpt.js +42 -0
- package/toolkit/dist/theme/content/nav.js +30 -0
- package/toolkit/dist/theme/content/seo.js +12 -0
- package/toolkit/dist/theme/createAntdApp.js +175 -0
- package/toolkit/dist/theme/createApp.js +141 -0
- package/toolkit/dist/theme/createCatalogApp.js +168 -0
- package/toolkit/dist/theme/customizer.js +5 -0
- package/toolkit/dist/theme/excerpt.js +31 -0
- package/toolkit/dist/theme/extension/branding-mods.js +65 -0
- package/toolkit/dist/theme/extension/configuration/defaults.js +32 -0
- package/toolkit/dist/theme/extension/configuration/formily.js +170 -0
- package/toolkit/dist/theme/extension/configuration/index.js +28 -0
- package/toolkit/dist/theme/extension/configuration/paths.js +7 -0
- package/toolkit/dist/theme/extension/configuration/presets/twentytwentyfive.js +94 -0
- package/toolkit/dist/theme/extension/configuration/resolve.js +98 -0
- package/toolkit/dist/theme/extension/configuration/types.js +3 -0
- package/toolkit/dist/theme/extension/configuration/validate.js +21 -0
- package/toolkit/dist/theme/extension/index.js +38 -0
- package/toolkit/dist/theme/extension/manifest-normalize.js +75 -0
- package/toolkit/dist/theme/extension/presets/twentytwentyfive-appearance.js +193 -0
- package/toolkit/dist/theme/extension/preview.js +92 -0
- package/toolkit/dist/theme/extension/site-notices.js +88 -0
- package/toolkit/dist/theme/extension/site-settings.js +144 -0
- package/toolkit/dist/theme/extension/siteNav.js +17 -0
- package/toolkit/dist/theme/extension/theme-admin-locale.io.js +54 -0
- package/toolkit/dist/theme/extension/theme-admin-locale.js +68 -0
- package/toolkit/dist/theme/extension/theme.js +93 -0
- package/toolkit/dist/theme/extension/twentytwentyfive-vars.js +103 -0
- package/toolkit/dist/theme/fetch.js +241 -0
- package/toolkit/dist/theme/format.js +48 -0
- package/toolkit/dist/theme/httpClient.js +89 -0
- package/toolkit/dist/theme/index.js +226 -0
- package/toolkit/dist/theme/json.js +17 -0
- package/toolkit/dist/theme/jsonp.js +27 -0
- package/toolkit/dist/theme/locale.js +55 -0
- package/toolkit/dist/theme/nav.js +30 -0
- package/toolkit/dist/theme/next-config.js +18 -0
- package/toolkit/dist/theme/node.js +18 -0
- package/toolkit/dist/theme/preview/preview-config.js +65 -0
- package/toolkit/dist/theme/preview/preview-draft.js +51 -0
- package/toolkit/dist/theme/preview/preview-mods.js +78 -0
- package/toolkit/dist/theme/preview-config.js +65 -0
- package/toolkit/dist/theme/preview-draft.js +51 -0
- package/toolkit/dist/theme/preview-mods.js +78 -0
- package/toolkit/dist/theme/providers/index.js +251 -0
- package/toolkit/dist/theme/providers/setup.js +29 -0
- package/toolkit/dist/theme/runtime.js +19 -0
- package/toolkit/dist/theme/seo.js +12 -0
- package/toolkit/dist/theme/server.js +177 -0
- package/toolkit/dist/theme/setting.js +42 -0
- package/toolkit/dist/theme/ssr/bootstrap.js +112 -0
- package/toolkit/dist/theme/ssr/fetch.js +264 -0
- package/toolkit/dist/theme/ssr/format.js +8 -0
- package/toolkit/dist/theme/ssr/pageProps.js +155 -0
- package/toolkit/dist/theme/ssr/setting.js +45 -0
- package/toolkit/dist/theme/ssr/slimBootstrap.js +75 -0
- package/toolkit/dist/theme/ssr/static.js +17 -0
- package/toolkit/dist/theme/ssr/templates.js +50 -0
- package/toolkit/dist/theme/static.js +17 -0
- package/toolkit/dist/theme/templates.js +38 -0
- package/toolkit/dist/theme/ui-optional.js +21 -0
- package/toolkit/dist/theme/visitor/appearance.js +16 -0
- package/toolkit/dist/theme/visitor/authSession.js +92 -0
- package/toolkit/dist/theme/visitor/colorMode.js +59 -0
- package/toolkit/dist/theme/visitor/commentAuthor.js +45 -0
- package/toolkit/dist/theme/visitor/i18n.js +28 -0
- package/toolkit/dist/theme/visitor/locale.js +72 -0
- package/toolkit/dist/theme/visitor/runtime.js +19 -0
- package/toolkit/dist/theme/visitor/visitorLocale.js +56 -0
- package/toolkit/dist/theme/visitorLocale.js +39 -0
- package/toolkit/dist/types/index.js +12 -0
- package/toolkit/dist/ui/AntdStyleTransitionFix.js +16 -0
- package/toolkit/dist/ui/ArchiveEmptyState.js +8 -0
- package/toolkit/dist/ui/ArchivePageLayout.js +8 -0
- package/toolkit/dist/ui/ArticleCard.js +16 -0
- package/toolkit/dist/ui/ArticleList.js +16 -0
- package/toolkit/dist/ui/BaseGlobalStyles.js +18 -0
- package/toolkit/dist/ui/LocaleSwitcher.js +15 -0
- package/toolkit/dist/ui/NavMenu.js +8 -0
- package/toolkit/dist/ui/NotFoundPanel.js +8 -0
- package/toolkit/dist/ui/PageHeader.js +8 -0
- package/toolkit/dist/ui/SiteBranding.js +14 -0
- package/toolkit/dist/ui/SiteDocument.js +13 -0
- package/toolkit/dist/ui/SiteDocumentFallback.js +9 -0
- package/toolkit/dist/ui/SiteLogo.js +16 -0
- package/toolkit/dist/ui/SiteTagline.js +15 -0
- package/toolkit/dist/ui/TaxonomyList.js +30 -0
- package/toolkit/dist/ui/ThemeCssVars.js +85 -0
- package/toolkit/dist/ui/ThemeLayout.js +11 -0
- package/toolkit/dist/ui/components/AntdStyleTransitionFix.js +16 -0
- package/toolkit/dist/ui/components/ArchiveEmptyState.js +8 -0
- package/toolkit/dist/ui/components/ArchivePageLayout.js +8 -0
- package/toolkit/dist/ui/components/ArticleCard.js +16 -0
- package/toolkit/dist/ui/components/ArticleList.js +16 -0
- package/toolkit/dist/ui/components/BaseGlobalStyles.js +18 -0
- package/toolkit/dist/ui/components/LocaleSwitcher.js +11 -0
- package/toolkit/dist/ui/components/NavMenu.js +8 -0
- package/toolkit/dist/ui/components/NotFoundPanel.js +8 -0
- package/toolkit/dist/ui/components/PageHeader.js +8 -0
- package/toolkit/dist/ui/components/RouteProgress.js +40 -0
- package/toolkit/dist/ui/components/SiteAnalytics.js +42 -0
- package/toolkit/dist/ui/components/SiteBranding.js +14 -0
- package/toolkit/dist/ui/components/SiteDocument.js +13 -0
- package/toolkit/dist/ui/components/SiteDocumentFallback.js +9 -0
- package/toolkit/dist/ui/components/SiteLogo.js +23 -0
- package/toolkit/dist/ui/components/SiteSeo.js +19 -0
- package/toolkit/dist/ui/components/SiteTagline.js +15 -0
- package/toolkit/dist/ui/components/TaxonomyList.js +30 -0
- package/toolkit/dist/ui/components/ThemeCssVars.js +85 -0
- package/toolkit/dist/ui/components/ThemeLayout.js +11 -0
- package/toolkit/dist/ui/components/content/ArticleReader.js +23 -0
- package/toolkit/dist/ui/components/content/ArticleToc.js +75 -0
- package/toolkit/dist/ui/components/content/HtmlContent.js +237 -0
- package/toolkit/dist/ui/components/content/Image.js +13 -0
- package/toolkit/dist/ui/components/content/ImageViewer.js +33 -0
- package/toolkit/dist/ui/components/content/LocaleTime.js +63 -0
- package/toolkit/dist/ui/components/content/index.js +18 -0
- package/toolkit/dist/ui/components/toolbar/LocaleToggleButton.js +18 -0
- package/toolkit/dist/ui/components/toolbar/ThemeToggleButton.js +10 -0
- package/toolkit/dist/ui/components/toolbar/ToolbarIconButton.js +22 -0
- package/toolkit/dist/ui/components/toolbar/constants.js +8 -0
- package/toolkit/dist/ui/components/toolbar/icons.js +44 -0
- package/toolkit/dist/ui/components/toolbar/index.js +25 -0
- package/toolkit/dist/ui/components/toolbar/locale-label.js +19 -0
- package/toolkit/dist/ui/context/LocaleContext.js +59 -0
- package/toolkit/dist/ui/context/ReactPressProvider.js +10 -0
- package/toolkit/dist/ui/context/SiteCatalogContext.js +60 -0
- package/toolkit/dist/ui/context/ThemeRuntimeContext.js +59 -0
- package/toolkit/dist/ui/context/index.js +26 -0
- package/toolkit/dist/ui/context/siteCatalogTypes.js +20 -0
- package/toolkit/dist/ui/context/types.js +2 -0
- package/toolkit/dist/ui/hooks/index.js +29 -0
- package/toolkit/dist/ui/hooks/useAsyncLoading.js +31 -0
- package/toolkit/dist/ui/hooks/useForceUpdate.js +11 -0
- package/toolkit/dist/ui/hooks/useNavActive.js +11 -0
- package/toolkit/dist/ui/hooks/usePagination.js +55 -0
- package/toolkit/dist/ui/hooks/useReportArticleView.js +40 -0
- package/toolkit/dist/ui/hooks/useReportPageView.js +28 -0
- package/toolkit/dist/ui/hooks/useRouteParam.js +15 -0
- package/toolkit/dist/ui/hooks/useToggle.js +17 -0
- package/toolkit/dist/ui/hooks/useWarningOnExit.js +59 -0
- package/toolkit/dist/ui/index.js +87 -0
- package/toolkit/dist/utils/api-envelope.js +31 -0
- package/toolkit/dist/utils/clipboard.js +24 -0
- package/toolkit/dist/utils/cookie.js +15 -0
- package/toolkit/dist/utils/date.js +45 -0
- package/toolkit/dist/utils/email.js +9 -0
- package/toolkit/dist/utils/error.js +26 -0
- package/toolkit/dist/utils/image.js +34 -0
- package/toolkit/dist/utils/index.js +39 -0
- package/toolkit/dist/utils/json.js +18 -0
- package/toolkit/dist/utils/jsonp.js +27 -0
- package/toolkit/dist/utils/object.js +63 -0
- package/toolkit/dist/utils/setting.js +13 -0
- package/toolkit/dist/utils/string.js +15 -0
- package/toolkit/dist/utils/viewport.js +14 -0
- package/toolkit/package-lock.json +452 -0
- package/toolkit/package.json +96 -0
- package/dist/cli.d.ts +0 -4
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/config.d.ts +0 -8
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/init.d.ts +0 -6
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/restart.d.ts +0 -2
- package/dist/commands/restart.d.ts.map +0 -1
- package/dist/commands/restart.js.map +0 -1
- package/dist/commands/start.d.ts +0 -2
- package/dist/commands/start.d.ts.map +0 -1
- package/dist/commands/start.js.map +0 -1
- package/dist/commands/status.d.ts +0 -2
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/stop.d.ts +0 -5
- package/dist/commands/stop.d.ts.map +0 -1
- package/dist/commands/stop.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/services/config.d.ts +0 -11
- package/dist/services/config.d.ts.map +0 -1
- package/dist/services/config.js.map +0 -1
- package/dist/services/database.d.ts +0 -43
- package/dist/services/database.d.ts.map +0 -1
- package/dist/services/database.js.map +0 -1
- package/dist/services/exec.d.ts +0 -22
- package/dist/services/exec.d.ts.map +0 -1
- package/dist/services/exec.js.map +0 -1
- package/dist/services/init.d.ts +0 -10
- package/dist/services/init.d.ts.map +0 -1
- package/dist/services/init.js.map +0 -1
- package/dist/services/process.d.ts +0 -9
- package/dist/services/process.d.ts.map +0 -1
- package/dist/services/process.js.map +0 -1
- package/dist/services/server-health.d.ts +0 -4
- package/dist/services/server-health.d.ts.map +0 -1
- package/dist/services/server-health.js.map +0 -1
- package/dist/services/server.d.ts +0 -19
- package/dist/services/server.d.ts.map +0 -1
- package/dist/services/server.js.map +0 -1
- package/dist/types/config.d.ts +0 -30
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/utils/cli-context.d.ts +0 -4
- package/dist/utils/cli-context.d.ts.map +0 -1
- package/dist/utils/cli-context.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -10
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -17
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/platform.d.ts +0 -8
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/port.d.ts +0 -5
- package/dist/utils/port.d.ts.map +0 -1
- package/dist/utils/port.js.map +0 -1
- package/dist/utils/server-bundle.d.ts +0 -11
- package/dist/utils/server-bundle.d.ts.map +0 -1
- package/dist/utils/server-bundle.js.map +0 -1
- package/out/bin/reactpress-cli-shim.d.ts +0 -3
- package/out/bin/reactpress-cli-shim.d.ts.map +0 -1
- package/out/bin/reactpress-cli-shim.js.map +0 -1
- package/out/bin/reactpress-theme-client.d.ts +0 -3
- package/out/bin/reactpress-theme-client.d.ts.map +0 -1
- package/out/bin/reactpress-theme-client.js.map +0 -1
- package/out/bin/reactpress.d.ts +0 -3
- package/out/bin/reactpress.d.ts.map +0 -1
- package/out/bin/reactpress.js.map +0 -1
- package/out/core/services/config.d.ts +0 -12
- package/out/core/services/config.d.ts.map +0 -1
- package/out/core/services/config.js.map +0 -1
- package/out/core/services/database/index.d.ts +0 -17
- package/out/core/services/database/index.d.ts.map +0 -1
- package/out/core/services/database/index.js.map +0 -1
- package/out/core/services/database/mysql.d.ts +0 -14
- package/out/core/services/database/mysql.d.ts.map +0 -1
- package/out/core/services/database/mysql.js.map +0 -1
- package/out/core/services/database/profile.d.ts +0 -6
- package/out/core/services/database/profile.d.ts.map +0 -1
- package/out/core/services/database/profile.js.map +0 -1
- package/out/core/services/database/sqlite.d.ts +0 -10
- package/out/core/services/database/sqlite.d.ts.map +0 -1
- package/out/core/services/database/sqlite.js.map +0 -1
- package/out/core/services/exec.d.ts +0 -21
- package/out/core/services/exec.d.ts.map +0 -1
- package/out/core/services/exec.js.map +0 -1
- package/out/core/services/init.d.ts +0 -11
- package/out/core/services/init.d.ts.map +0 -1
- package/out/core/services/init.js.map +0 -1
- package/out/core/services/local-site.d.ts +0 -24
- package/out/core/services/local-site.d.ts.map +0 -1
- package/out/core/services/local-site.js.map +0 -1
- package/out/core/utils/cli-context.d.ts +0 -3
- package/out/core/utils/cli-context.d.ts.map +0 -1
- package/out/core/utils/cli-context.js.map +0 -1
- package/out/core/utils/paths.d.ts +0 -20
- package/out/core/utils/paths.d.ts.map +0 -1
- package/out/core/utils/paths.js.map +0 -1
- package/out/core/utils/platform.d.ts +0 -7
- package/out/core/utils/platform.d.ts.map +0 -1
- package/out/core/utils/platform.js.map +0 -1
- package/out/core/utils/port.d.ts +0 -4
- package/out/core/utils/port.d.ts.map +0 -1
- package/out/core/utils/port.js.map +0 -1
- package/out/lib/api-dev-runner.d.ts +0 -3
- package/out/lib/api-dev-runner.d.ts.map +0 -1
- package/out/lib/api-dev-runner.js.map +0 -1
- package/out/lib/api-dev.d.ts +0 -2
- package/out/lib/api-dev.d.ts.map +0 -1
- package/out/lib/api-dev.js.map +0 -1
- package/out/lib/bootstrap.d.ts +0 -18
- package/out/lib/bootstrap.d.ts.map +0 -1
- package/out/lib/bootstrap.js.map +0 -1
- package/out/lib/build.d.ts +0 -2
- package/out/lib/build.d.ts.map +0 -1
- package/out/lib/build.js.map +0 -1
- package/out/lib/db-backup.d.ts +0 -2
- package/out/lib/db-backup.d.ts.map +0 -1
- package/out/lib/db-backup.js.map +0 -1
- package/out/lib/dev-banner.d.ts +0 -2
- package/out/lib/dev-banner.d.ts.map +0 -1
- package/out/lib/dev-banner.js.map +0 -1
- package/out/lib/dev-child-io.d.ts +0 -2
- package/out/lib/dev-child-io.d.ts.map +0 -1
- package/out/lib/dev-child-io.js.map +0 -1
- package/out/lib/dev-log.d.ts +0 -2
- package/out/lib/dev-log.d.ts.map +0 -1
- package/out/lib/dev-log.js.map +0 -1
- package/out/lib/dev-session.d.ts +0 -2
- package/out/lib/dev-session.d.ts.map +0 -1
- package/out/lib/dev-session.js.map +0 -1
- package/out/lib/dev.d.ts +0 -2
- package/out/lib/dev.d.ts.map +0 -1
- package/out/lib/dev.js.map +0 -1
- package/out/lib/docker.d.ts +0 -2
- package/out/lib/docker.d.ts.map +0 -1
- package/out/lib/docker.js.map +0 -1
- package/out/lib/doctor.d.ts +0 -2
- package/out/lib/doctor.d.ts.map +0 -1
- package/out/lib/doctor.js.map +0 -1
- package/out/lib/health-parse.d.ts +0 -5
- package/out/lib/health-parse.d.ts.map +0 -1
- package/out/lib/health-parse.js.map +0 -1
- package/out/lib/health-parse.test.d.ts +0 -2
- package/out/lib/health-parse.test.d.ts.map +0 -1
- package/out/lib/health-parse.test.js.map +0 -1
- package/out/lib/http.d.ts +0 -2
- package/out/lib/http.d.ts.map +0 -1
- package/out/lib/http.js.map +0 -1
- package/out/lib/i18n/index.d.ts +0 -2
- package/out/lib/i18n/index.d.ts.map +0 -1
- package/out/lib/i18n/index.js.map +0 -1
- package/out/lib/i18n/strings.d.ts +0 -2
- package/out/lib/i18n/strings.d.ts.map +0 -1
- package/out/lib/i18n/strings.js.map +0 -1
- package/out/lib/lifecycle.d.ts +0 -2
- package/out/lib/lifecycle.d.ts.map +0 -1
- package/out/lib/lifecycle.js.map +0 -1
- package/out/lib/nginx.d.ts +0 -2
- package/out/lib/nginx.d.ts.map +0 -1
- package/out/lib/nginx.js.map +0 -1
- package/out/lib/paths.d.ts +0 -2
- package/out/lib/paths.d.ts.map +0 -1
- package/out/lib/paths.js.map +0 -1
- package/out/lib/plugin-build.d.ts +0 -2
- package/out/lib/plugin-build.d.ts.map +0 -1
- package/out/lib/plugin-build.js.map +0 -1
- package/out/lib/plugin-cli.d.ts +0 -2
- package/out/lib/plugin-cli.d.ts.map +0 -1
- package/out/lib/plugin-cli.js.map +0 -1
- package/out/lib/pm2.d.ts +0 -2
- package/out/lib/pm2.d.ts.map +0 -1
- package/out/lib/pm2.js.map +0 -1
- package/out/lib/ports.d.ts +0 -2
- package/out/lib/ports.d.ts.map +0 -1
- package/out/lib/ports.js.map +0 -1
- package/out/lib/process.d.ts +0 -2
- package/out/lib/process.d.ts.map +0 -1
- package/out/lib/process.js.map +0 -1
- package/out/lib/prod-memory.d.ts +0 -6
- package/out/lib/prod-memory.d.ts.map +0 -1
- package/out/lib/prod-memory.js.map +0 -1
- package/out/lib/project-type.d.ts +0 -2
- package/out/lib/project-type.d.ts.map +0 -1
- package/out/lib/project-type.js.map +0 -1
- package/out/lib/publish.d.ts +0 -3
- package/out/lib/publish.d.ts.map +0 -1
- package/out/lib/publish.js.map +0 -1
- package/out/lib/remote-dev.d.ts +0 -2
- package/out/lib/remote-dev.d.ts.map +0 -1
- package/out/lib/remote-dev.js.map +0 -1
- package/out/lib/root.d.ts +0 -2
- package/out/lib/root.d.ts.map +0 -1
- package/out/lib/root.js.map +0 -1
- package/out/lib/spawn.d.ts +0 -2
- package/out/lib/spawn.d.ts.map +0 -1
- package/out/lib/spawn.js.map +0 -1
- package/out/lib/status.d.ts +0 -2
- package/out/lib/status.d.ts.map +0 -1
- package/out/lib/status.js.map +0 -1
- package/out/lib/theme-catalog.d.ts +0 -2
- package/out/lib/theme-catalog.d.ts.map +0 -1
- package/out/lib/theme-catalog.js.map +0 -1
- package/out/lib/theme-cli.d.ts +0 -2
- package/out/lib/theme-cli.d.ts.map +0 -1
- package/out/lib/theme-cli.js.map +0 -1
- package/out/lib/theme-dev.d.ts +0 -2
- package/out/lib/theme-dev.d.ts.map +0 -1
- package/out/lib/theme-dev.js.map +0 -1
- package/out/lib/theme-env.d.ts +0 -2
- package/out/lib/theme-env.d.ts.map +0 -1
- package/out/lib/theme-env.js.map +0 -1
- package/out/lib/theme-install.d.ts +0 -2
- package/out/lib/theme-install.d.ts.map +0 -1
- package/out/lib/theme-install.js.map +0 -1
- package/out/lib/theme-lock.d.ts +0 -2
- package/out/lib/theme-lock.d.ts.map +0 -1
- package/out/lib/theme-lock.js.map +0 -1
- package/out/lib/theme-paths.d.ts +0 -2
- package/out/lib/theme-paths.d.ts.map +0 -1
- package/out/lib/theme-paths.js.map +0 -1
- package/out/lib/theme-placeholder-cover.d.ts +0 -13
- package/out/lib/theme-placeholder-cover.d.ts.map +0 -1
- package/out/lib/theme-placeholder-cover.js.map +0 -1
- package/out/lib/theme-preview-frame.d.ts +0 -2
- package/out/lib/theme-preview-frame.d.ts.map +0 -1
- package/out/lib/theme-preview-frame.js.map +0 -1
- package/out/lib/theme-preview-pool.d.ts +0 -2
- package/out/lib/theme-preview-pool.d.ts.map +0 -1
- package/out/lib/theme-preview-pool.js.map +0 -1
- package/out/lib/theme-preview-proxy.d.ts +0 -2
- package/out/lib/theme-preview-proxy.d.ts.map +0 -1
- package/out/lib/theme-preview-proxy.js.map +0 -1
- package/out/lib/theme-prod.d.ts +0 -2
- package/out/lib/theme-prod.d.ts.map +0 -1
- package/out/lib/theme-prod.js.map +0 -1
- package/out/lib/theme-registry.d.ts +0 -2
- package/out/lib/theme-registry.d.ts.map +0 -1
- package/out/lib/theme-registry.js.map +0 -1
- package/out/lib/theme-runtime.d.ts +0 -2
- package/out/lib/theme-runtime.d.ts.map +0 -1
- package/out/lib/theme-runtime.js.map +0 -1
- package/out/lib/theme-sources.d.ts +0 -2
- package/out/lib/theme-sources.d.ts.map +0 -1
- package/out/lib/theme-sources.js.map +0 -1
- package/out/lib/theme-warmup.d.ts +0 -2
- package/out/lib/theme-warmup.d.ts.map +0 -1
- package/out/lib/theme-warmup.js.map +0 -1
- package/out/lib/toolkit-build.d.ts +0 -2
- package/out/lib/toolkit-build.d.ts.map +0 -1
- package/out/lib/toolkit-build.js.map +0 -1
- package/out/types/config.d.ts +0 -57
- package/out/types/config.d.ts.map +0 -1
- package/out/types/config.js.map +0 -1
- package/out/ui/banner.d.ts +0 -2
- package/out/ui/banner.d.ts.map +0 -1
- package/out/ui/banner.js.map +0 -1
- package/out/ui/interactive.d.ts +0 -2
- package/out/ui/interactive.d.ts.map +0 -1
- package/out/ui/interactive.js.map +0 -1
- package/out/ui/prompts.d.ts +0 -2
- package/out/ui/prompts.d.ts.map +0 -1
- package/out/ui/prompts.js.map +0 -1
- package/out/ui/theme.d.ts +0 -2
- package/out/ui/theme.d.ts.map +0 -1
- package/out/ui/theme.js.map +0 -1
- package/server/dist/app.module.d.ts +0 -2
- package/server/dist/app.module.js.map +0 -1
- package/server/dist/common/api-messages.d.ts +0 -41
- package/server/dist/common/api-messages.js.map +0 -1
- package/server/dist/database/typeorm-options.d.ts +0 -3
- package/server/dist/database/typeorm-options.js.map +0 -1
- package/server/dist/filters/http-exception.filter.d.ts +0 -4
- package/server/dist/filters/http-exception.filter.js.map +0 -1
- package/server/dist/generate-swagger.d.ts +0 -1
- package/server/dist/generate-swagger.js.map +0 -1
- package/server/dist/interceptors/transform.interceptor.d.ts +0 -9
- package/server/dist/interceptors/transform.interceptor.js.map +0 -1
- package/server/dist/logger/index.d.ts +0 -4
- package/server/dist/logger/index.js.map +0 -1
- package/server/dist/main.d.ts +0 -6
- package/server/dist/main.js.map +0 -1
- package/server/dist/modules/api-key/api-key.controller.d.ts +0 -14
- package/server/dist/modules/api-key/api-key.controller.js.map +0 -1
- package/server/dist/modules/api-key/api-key.entity.d.ts +0 -11
- package/server/dist/modules/api-key/api-key.entity.js.map +0 -1
- package/server/dist/modules/api-key/api-key.guard.d.ts +0 -7
- package/server/dist/modules/api-key/api-key.guard.js.map +0 -1
- package/server/dist/modules/api-key/api-key.module.d.ts +0 -2
- package/server/dist/modules/api-key/api-key.module.js.map +0 -1
- package/server/dist/modules/api-key/api-key.service.d.ts +0 -15
- package/server/dist/modules/api-key/api-key.service.js.map +0 -1
- package/server/dist/modules/article/article-revision.entity.d.ts +0 -11
- package/server/dist/modules/article/article-revision.entity.js.map +0 -1
- package/server/dist/modules/article/article-slug.util.d.ts +0 -2
- package/server/dist/modules/article/article-slug.util.js.map +0 -1
- package/server/dist/modules/article/article.controller.d.ts +0 -27
- package/server/dist/modules/article/article.controller.js.map +0 -1
- package/server/dist/modules/article/article.entity.d.ts +0 -23
- package/server/dist/modules/article/article.entity.js.map +0 -1
- package/server/dist/modules/article/article.module.d.ts +0 -2
- package/server/dist/modules/article/article.module.js.map +0 -1
- package/server/dist/modules/article/article.service.d.ts +0 -30
- package/server/dist/modules/article/article.service.js.map +0 -1
- package/server/dist/modules/article/article.util.d.ts +0 -1
- package/server/dist/modules/article/article.util.js.map +0 -1
- package/server/dist/modules/article/scheduled-publish.service.d.ts +0 -13
- package/server/dist/modules/article/scheduled-publish.service.js.map +0 -1
- package/server/dist/modules/auth/auth.controller.d.ts +0 -12
- package/server/dist/modules/auth/auth.controller.js.map +0 -1
- package/server/dist/modules/auth/auth.module.d.ts +0 -2
- package/server/dist/modules/auth/auth.module.js.map +0 -1
- package/server/dist/modules/auth/auth.service.d.ts +0 -26
- package/server/dist/modules/auth/auth.service.js.map +0 -1
- package/server/dist/modules/auth/jwt-auth.guard.d.ts +0 -7
- package/server/dist/modules/auth/jwt-auth.guard.js.map +0 -1
- package/server/dist/modules/auth/jwt.strategy.d.ts +0 -9
- package/server/dist/modules/auth/jwt.strategy.js.map +0 -1
- package/server/dist/modules/auth/roles.guard.d.ts +0 -10
- package/server/dist/modules/auth/roles.guard.js.map +0 -1
- package/server/dist/modules/bootstrap/bootstrap.constants.d.ts +0 -20
- package/server/dist/modules/bootstrap/bootstrap.constants.js.map +0 -1
- package/server/dist/modules/bootstrap/bootstrap.service.d.ts +0 -22
- package/server/dist/modules/bootstrap/bootstrap.service.js.map +0 -1
- package/server/dist/modules/bootstrap/install-locale.d.ts +0 -2
- package/server/dist/modules/bootstrap/install-locale.js.map +0 -1
- package/server/dist/modules/category/category.controller.d.ts +0 -11
- package/server/dist/modules/category/category.controller.js.map +0 -1
- package/server/dist/modules/category/category.entity.d.ts +0 -9
- package/server/dist/modules/category/category.entity.js.map +0 -1
- package/server/dist/modules/category/category.module.d.ts +0 -2
- package/server/dist/modules/category/category.module.js.map +0 -1
- package/server/dist/modules/category/category.service.d.ts +0 -12
- package/server/dist/modules/category/category.service.js.map +0 -1
- package/server/dist/modules/comment/comment.controller.d.ts +0 -12
- package/server/dist/modules/comment/comment.controller.js.map +0 -1
- package/server/dist/modules/comment/comment.entity.d.ts +0 -17
- package/server/dist/modules/comment/comment.entity.js.map +0 -1
- package/server/dist/modules/comment/comment.module.d.ts +0 -2
- package/server/dist/modules/comment/comment.module.js.map +0 -1
- package/server/dist/modules/comment/comment.service.d.ts +0 -24
- package/server/dist/modules/comment/comment.service.js.map +0 -1
- package/server/dist/modules/comment/html.d.ts +0 -15
- package/server/dist/modules/comment/html.js.map +0 -1
- package/server/dist/modules/extension/extension.module.d.ts +0 -9
- package/server/dist/modules/extension/extension.module.js.map +0 -1
- package/server/dist/modules/extension/plugin-loader.service.d.ts +0 -12
- package/server/dist/modules/extension/plugin-loader.service.js.map +0 -1
- package/server/dist/modules/extension/plugin-registry.bridge.d.ts +0 -3
- package/server/dist/modules/extension/plugin-registry.bridge.js.map +0 -1
- package/server/dist/modules/extension/plugin.controller.d.ts +0 -22
- package/server/dist/modules/extension/plugin.controller.js.map +0 -1
- package/server/dist/modules/extension/plugin.service.d.ts +0 -52
- package/server/dist/modules/extension/plugin.service.js.map +0 -1
- package/server/dist/modules/extension/preview-draft.store.d.ts +0 -13
- package/server/dist/modules/extension/preview-draft.store.js.map +0 -1
- package/server/dist/modules/extension/theme-registry.bridge.d.ts +0 -56
- package/server/dist/modules/extension/theme-registry.bridge.js.map +0 -1
- package/server/dist/modules/extension/theme.controller.d.ts +0 -66
- package/server/dist/modules/extension/theme.controller.js.map +0 -1
- package/server/dist/modules/extension/theme.service.d.ts +0 -140
- package/server/dist/modules/extension/theme.service.js.map +0 -1
- package/server/dist/modules/file/file-optimization.controller.d.ts +0 -12
- package/server/dist/modules/file/file-optimization.controller.js.map +0 -1
- package/server/dist/modules/file/file-optimization.service.d.ts +0 -36
- package/server/dist/modules/file/file-optimization.service.js.map +0 -1
- package/server/dist/modules/file/file-optimization.types.d.ts +0 -66
- package/server/dist/modules/file/file-optimization.types.js.map +0 -1
- package/server/dist/modules/file/file.controller.d.ts +0 -10
- package/server/dist/modules/file/file.controller.js.map +0 -1
- package/server/dist/modules/file/file.entity.d.ts +0 -9
- package/server/dist/modules/file/file.entity.js.map +0 -1
- package/server/dist/modules/file/file.module.d.ts +0 -2
- package/server/dist/modules/file/file.module.js.map +0 -1
- package/server/dist/modules/file/file.service.d.ts +0 -17
- package/server/dist/modules/file/file.service.js.map +0 -1
- package/server/dist/modules/file/image-optimizer-plugin.guard.d.ts +0 -7
- package/server/dist/modules/file/image-optimizer-plugin.guard.js.map +0 -1
- package/server/dist/modules/health/health.controller.d.ts +0 -11
- package/server/dist/modules/health/health.controller.js.map +0 -1
- package/server/dist/modules/health/health.module.d.ts +0 -2
- package/server/dist/modules/health/health.module.js.map +0 -1
- package/server/dist/modules/hook/hook.module.d.ts +0 -2
- package/server/dist/modules/hook/hook.module.js.map +0 -1
- package/server/dist/modules/hook/hook.service.d.ts +0 -26
- package/server/dist/modules/hook/hook.service.js.map +0 -1
- package/server/dist/modules/install/install.controller.d.ts +0 -11
- package/server/dist/modules/install/install.controller.js.map +0 -1
- package/server/dist/modules/install/install.module.d.ts +0 -2
- package/server/dist/modules/install/install.module.js.map +0 -1
- package/server/dist/modules/install/install.service.d.ts +0 -12
- package/server/dist/modules/install/install.service.js.map +0 -1
- package/server/dist/modules/knowledge/knowledge.controller.d.ts +0 -14
- package/server/dist/modules/knowledge/knowledge.controller.js.map +0 -1
- package/server/dist/modules/knowledge/knowledge.entity.d.ts +0 -18
- package/server/dist/modules/knowledge/knowledge.entity.js.map +0 -1
- package/server/dist/modules/knowledge/knowledge.module.d.ts +0 -2
- package/server/dist/modules/knowledge/knowledge.module.js.map +0 -1
- package/server/dist/modules/knowledge/knowledge.service.d.ts +0 -14
- package/server/dist/modules/knowledge/knowledge.service.js.map +0 -1
- package/server/dist/modules/page/page.controller.d.ts +0 -12
- package/server/dist/modules/page/page.controller.js.map +0 -1
- package/server/dist/modules/page/page.entity.d.ts +0 -15
- package/server/dist/modules/page/page.entity.js.map +0 -1
- package/server/dist/modules/page/page.module.d.ts +0 -2
- package/server/dist/modules/page/page.module.js.map +0 -1
- package/server/dist/modules/page/page.service.d.ts +0 -12
- package/server/dist/modules/page/page.service.js.map +0 -1
- package/server/dist/modules/search/search.controller.d.ts +0 -8
- package/server/dist/modules/search/search.controller.js.map +0 -1
- package/server/dist/modules/search/search.entity.d.ts +0 -8
- package/server/dist/modules/search/search.entity.js.map +0 -1
- package/server/dist/modules/search/search.module.d.ts +0 -2
- package/server/dist/modules/search/search.module.js.map +0 -1
- package/server/dist/modules/search/search.service.d.ts +0 -12
- package/server/dist/modules/search/search.service.js.map +0 -1
- package/server/dist/modules/setting/setting.constant.d.ts +0 -3
- package/server/dist/modules/setting/setting.constant.js.map +0 -1
- package/server/dist/modules/setting/setting.controller.d.ts +0 -12
- package/server/dist/modules/setting/setting.controller.js.map +0 -1
- package/server/dist/modules/setting/setting.entity.d.ts +0 -26
- package/server/dist/modules/setting/setting.entity.js.map +0 -1
- package/server/dist/modules/setting/setting.module.d.ts +0 -2
- package/server/dist/modules/setting/setting.module.js.map +0 -1
- package/server/dist/modules/setting/setting.service.d.ts +0 -10
- package/server/dist/modules/setting/setting.service.js.map +0 -1
- package/server/dist/modules/smtp/mail.util.d.ts +0 -6
- package/server/dist/modules/smtp/mail.util.js.map +0 -1
- package/server/dist/modules/smtp/smtp.controller.d.ts +0 -9
- package/server/dist/modules/smtp/smtp.controller.js.map +0 -1
- package/server/dist/modules/smtp/smtp.entity.d.ts +0 -9
- package/server/dist/modules/smtp/smtp.entity.js.map +0 -1
- package/server/dist/modules/smtp/smtp.module.d.ts +0 -2
- package/server/dist/modules/smtp/smtp.module.js.map +0 -1
- package/server/dist/modules/smtp/smtp.service.d.ts +0 -11
- package/server/dist/modules/smtp/smtp.service.js.map +0 -1
- package/server/dist/modules/tag/tag.controller.d.ts +0 -12
- package/server/dist/modules/tag/tag.controller.js.map +0 -1
- package/server/dist/modules/tag/tag.entity.d.ts +0 -9
- package/server/dist/modules/tag/tag.entity.js.map +0 -1
- package/server/dist/modules/tag/tag.module.d.ts +0 -2
- package/server/dist/modules/tag/tag.module.js.map +0 -1
- package/server/dist/modules/tag/tag.service.d.ts +0 -13
- package/server/dist/modules/tag/tag.service.js.map +0 -1
- package/server/dist/modules/user/user.controller.d.ts +0 -13
- package/server/dist/modules/user/user.controller.js.map +0 -1
- package/server/dist/modules/user/user.entity.d.ts +0 -15
- package/server/dist/modules/user/user.entity.js.map +0 -1
- package/server/dist/modules/user/user.module.d.ts +0 -2
- package/server/dist/modules/user/user.module.js.map +0 -1
- package/server/dist/modules/user/user.service.d.ts +0 -16
- package/server/dist/modules/user/user.service.js.map +0 -1
- package/server/dist/modules/view/view.controller.d.ts +0 -11
- package/server/dist/modules/view/view.controller.js.map +0 -1
- package/server/dist/modules/view/view.entity.d.ts +0 -14
- package/server/dist/modules/view/view.entity.js.map +0 -1
- package/server/dist/modules/view/view.module.d.ts +0 -2
- package/server/dist/modules/view/view.module.js.map +0 -1
- package/server/dist/modules/view/view.service.d.ts +0 -11
- package/server/dist/modules/view/view.service.js.map +0 -1
- package/server/dist/modules/webhook/webhook.controller.d.ts +0 -12
- package/server/dist/modules/webhook/webhook.controller.js.map +0 -1
- package/server/dist/modules/webhook/webhook.entity.d.ts +0 -9
- package/server/dist/modules/webhook/webhook.entity.js.map +0 -1
- package/server/dist/modules/webhook/webhook.module.d.ts +0 -2
- package/server/dist/modules/webhook/webhook.module.js.map +0 -1
- package/server/dist/modules/webhook/webhook.service.d.ts +0 -16
- package/server/dist/modules/webhook/webhook.service.js.map +0 -1
- package/server/dist/node-polyfills.d.ts +0 -18
- package/server/dist/node-polyfills.js.map +0 -1
- package/server/dist/public/apple-touch-icon.png +0 -0
- package/server/dist/public/favicon-16.png +0 -0
- package/server/dist/public/favicon-32.png +0 -0
- package/server/dist/public/favicon-48.png +0 -0
- package/server/dist/public/favicon.ico +0 -0
- package/server/dist/public/favicon.png +0 -0
- package/server/dist/public/icon-192.png +0 -0
- package/server/dist/public/icon-512.png +0 -0
- package/server/dist/public/index.html +0 -439
- package/server/dist/public/logo-200.png +0 -0
- package/server/dist/public/logo-400.png +0 -0
- package/server/dist/public/logo.png +0 -0
- package/server/dist/public/logo.svg +0 -7
- package/server/dist/public/swagger/custom.css +0 -11
- package/server/dist/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
- package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
- package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
- package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
- package/server/dist/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
- package/server/dist/starter.d.ts +0 -1
- package/server/dist/starter.js.map +0 -1
- package/server/dist/tsconfig.build.tsbuildinfo +0 -16764
- package/server/dist/tsconfig.tsbuildinfo +0 -1
- package/server/dist/utils/date.util.d.ts +0 -1
- package/server/dist/utils/date.util.js.map +0 -1
- package/server/dist/utils/html-sanitize.util.d.ts +0 -1
- package/server/dist/utils/html-sanitize.util.js.map +0 -1
- package/server/dist/utils/image-processor.util.d.ts +0 -23
- package/server/dist/utils/image-processor.util.js.map +0 -1
- package/server/dist/utils/ip.util.d.ts +0 -2
- package/server/dist/utils/ip.util.js.map +0 -1
- package/server/dist/utils/local-api-quiet.util.d.ts +0 -1
- package/server/dist/utils/local-api-quiet.util.js.map +0 -1
- package/server/dist/utils/markdown.util.d.ts +0 -4
- package/server/dist/utils/markdown.util.js.map +0 -1
- package/server/dist/utils/oss/aliyun-oss-client.d.ts +0 -6
- package/server/dist/utils/oss/aliyun-oss-client.js.map +0 -1
- package/server/dist/utils/oss/oss-client.d.ts +0 -6
- package/server/dist/utils/oss/oss-client.js.map +0 -1
- package/server/dist/utils/oss.util.d.ts +0 -13
- package/server/dist/utils/oss.util.js.map +0 -1
- package/server/dist/utils/project-root.util.d.ts +0 -2
- package/server/dist/utils/project-root.util.js.map +0 -1
- package/server/dist/utils/query-whitelist.util.d.ts +0 -1
- package/server/dist/utils/query-whitelist.util.js.map +0 -1
- package/server/dist/utils/ua.util.d.ts +0 -9
- package/server/dist/utils/ua.util.js.map +0 -1
- package/server/dist/utils/uniqueid.util.d.ts +0 -1
- package/server/dist/utils/uniqueid.util.js.map +0 -1
- package/server/dist/utils/upload.util.d.ts +0 -5
- package/server/dist/utils/upload.util.js.map +0 -1
- package/server/dist/utils/user.util.d.ts +0 -1
- package/server/dist/utils/user.util.js.map +0 -1
- package/server/logs/error/error.log.-2026-05-19.log +0 -135
- package/server/logs/request/request.log.-2026-05-19.log +0 -0
- package/server/logs/response/response.log.-2026-05-19.log +0 -121
- package/server/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
- package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
- package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
- package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
- package/server/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.THEME_ISR_REVALIDATE_SECONDS = void 0;
|
|
4
|
+
exports.withApiRetry = withApiRetry;
|
|
5
|
+
exports.fetchThemeCatalog = fetchThemeCatalog;
|
|
6
|
+
exports.sanitizeNextProps = sanitizeNextProps;
|
|
7
|
+
exports.themeStaticProps = themeStaticProps;
|
|
8
|
+
exports.resolveStaticVisitorContext = resolveStaticVisitorContext;
|
|
9
|
+
exports.fetchCategoryIndex = fetchCategoryIndex;
|
|
10
|
+
exports.fetchTagIndex = fetchTagIndex;
|
|
11
|
+
exports.fetchSiteSettings = fetchSiteSettings;
|
|
12
|
+
exports.createDefaultVisitorContext = createDefaultVisitorContext;
|
|
13
|
+
exports.fetchVisitorContext = fetchVisitorContext;
|
|
14
|
+
exports.fetchSiteMeta = fetchSiteMeta;
|
|
15
|
+
exports.fetchCategoryArchive = fetchCategoryArchive;
|
|
16
|
+
exports.fetchTagArchive = fetchTagArchive;
|
|
17
|
+
exports.fetchSingleArticle = fetchSingleArticle;
|
|
18
|
+
exports.fetchSearchArticles = fetchSearchArticles;
|
|
19
|
+
exports.withThemeStaticProps = withThemeStaticProps;
|
|
20
|
+
exports.createArchiveGetStaticProps = createArchiveGetStaticProps;
|
|
21
|
+
exports.fetchArticlePageProps = fetchArticlePageProps;
|
|
22
|
+
const api_1 = require("../api/api");
|
|
23
|
+
const api_data_1 = require("../api/api-data");
|
|
24
|
+
const assets_1 = require("../content/assets");
|
|
25
|
+
const format_1 = require("./format");
|
|
26
|
+
const json_1 = require("../api/json");
|
|
27
|
+
const locale_1 = require("../visitor/locale");
|
|
28
|
+
const runtime_1 = require("../visitor/runtime");
|
|
29
|
+
const setting_1 = require("./setting");
|
|
30
|
+
const static_1 = require("./static");
|
|
31
|
+
/** Default ISR interval for theme list/home pages. */
|
|
32
|
+
exports.THEME_ISR_REVALIDATE_SECONDS = 60;
|
|
33
|
+
function isConnectionRefused(error) {
|
|
34
|
+
const err = error;
|
|
35
|
+
return err?.code === 'ECONNREFUSED' || err?.cause?.code === 'ECONNREFUSED';
|
|
36
|
+
}
|
|
37
|
+
function isRetryableNetworkError(error) {
|
|
38
|
+
if (isConnectionRefused(error))
|
|
39
|
+
return true;
|
|
40
|
+
const err = error;
|
|
41
|
+
const code = err?.code || err?.cause?.code;
|
|
42
|
+
const message = `${err?.message || ''} ${err?.cause?.message || ''}`.toLowerCase();
|
|
43
|
+
return (code === 'ECONNRESET' ||
|
|
44
|
+
code === 'ETIMEDOUT' ||
|
|
45
|
+
code === 'EPIPE' ||
|
|
46
|
+
message.includes('socket hang up') ||
|
|
47
|
+
message.includes('network error') ||
|
|
48
|
+
message.includes('timeout'));
|
|
49
|
+
}
|
|
50
|
+
/** Retry SSR API calls during dev startup or flaky remote connections. */
|
|
51
|
+
async function withApiRetry(fn, attempts = 8, delayMs = 400) {
|
|
52
|
+
let lastError;
|
|
53
|
+
for (let i = 0; i < attempts; i += 1) {
|
|
54
|
+
try {
|
|
55
|
+
return await fn();
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
lastError = error;
|
|
59
|
+
if (!isRetryableNetworkError(error) || i >= attempts - 1) {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
await new Promise((resolve) => {
|
|
63
|
+
setTimeout(resolve, delayMs);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
throw lastError;
|
|
68
|
+
}
|
|
69
|
+
/** Articles, categories, and tags for home / toolkit demo pages. */
|
|
70
|
+
async function fetchThemeCatalog(api) {
|
|
71
|
+
return withApiRetry(async () => {
|
|
72
|
+
const [articlesResponse, categoriesResponse, tagsResponse] = await Promise.all([
|
|
73
|
+
api.article.findAll(),
|
|
74
|
+
api.category.findAll(),
|
|
75
|
+
api.tag.findAll(),
|
|
76
|
+
]);
|
|
77
|
+
return {
|
|
78
|
+
articles: (0, api_data_1.unpackPaginated)(articlesResponse),
|
|
79
|
+
categories: (0, api_data_1.unpackList)(categoriesResponse),
|
|
80
|
+
tags: (0, api_data_1.unpackList)(tagsResponse),
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** Strip `undefined` values so Next.js can serialize `getStaticProps` results. */
|
|
85
|
+
function sanitizeNextProps(props) {
|
|
86
|
+
return JSON.parse(JSON.stringify(props));
|
|
87
|
+
}
|
|
88
|
+
function themeStaticProps(props, revalidate = exports.THEME_ISR_REVALIDATE_SECONDS) {
|
|
89
|
+
return { props: sanitizeNextProps(props), revalidate };
|
|
90
|
+
}
|
|
91
|
+
let staticVisitorContextPromise = null;
|
|
92
|
+
let staticVisitorContextKey = '';
|
|
93
|
+
/** Visitor context for `getStaticProps` — `_app.getInitialProps` does not run on SSR for static pages. */
|
|
94
|
+
async function resolveStaticVisitorContext() {
|
|
95
|
+
const themeId = process.env.REACTPRESS_THEME_ID?.trim() || 'starter-theme';
|
|
96
|
+
const honorPreview = process.env.REACTPRESS_HONOR_PREVIEW === '1';
|
|
97
|
+
const cacheKey = `${themeId}:${honorPreview ? '1' : '0'}`;
|
|
98
|
+
if (staticVisitorContextPromise && staticVisitorContextKey === cacheKey) {
|
|
99
|
+
return staticVisitorContextPromise;
|
|
100
|
+
}
|
|
101
|
+
staticVisitorContextKey = cacheKey;
|
|
102
|
+
staticVisitorContextPromise = (async () => {
|
|
103
|
+
try {
|
|
104
|
+
return await fetchVisitorContext(api_1.themeApi, { themeId, honorPreview });
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
const code = error?.code
|
|
108
|
+
?? error?.cause?.code;
|
|
109
|
+
if (code !== 'ECONNREFUSED') {
|
|
110
|
+
console.error('[reactpress] resolveStaticVisitorContext failed', error);
|
|
111
|
+
}
|
|
112
|
+
return createDefaultVisitorContext(themeId);
|
|
113
|
+
}
|
|
114
|
+
})();
|
|
115
|
+
return staticVisitorContextPromise;
|
|
116
|
+
}
|
|
117
|
+
/** All categories — `getStaticProps` for `pages/category/index.tsx`. */
|
|
118
|
+
async function fetchCategoryIndex(api) {
|
|
119
|
+
return { categories: (0, api_data_1.unpackList)(await api.category.findAll()) };
|
|
120
|
+
}
|
|
121
|
+
/** All tags — `getStaticProps` for `pages/tag/index.tsx`. */
|
|
122
|
+
async function fetchTagIndex(api) {
|
|
123
|
+
return { tags: (0, api_data_1.unpackList)(await api.tag.findAll()) };
|
|
124
|
+
}
|
|
125
|
+
/** Site settings for about/footer pages (`getStaticProps`). */
|
|
126
|
+
async function fetchSiteSettings(api, schema) {
|
|
127
|
+
const rows = (0, api_data_1.unpackList)(await api.setting.findAll());
|
|
128
|
+
return (0, format_1.pickSiteSettings)(rows, schema);
|
|
129
|
+
}
|
|
130
|
+
/** Safe defaults when API is unreachable (still wraps pages in Provider). */
|
|
131
|
+
function createDefaultVisitorContext(themeId, partial = {}) {
|
|
132
|
+
return {
|
|
133
|
+
locale: 'zh',
|
|
134
|
+
locales: ['zh', 'en'],
|
|
135
|
+
messages: {},
|
|
136
|
+
catalog: {},
|
|
137
|
+
themeId,
|
|
138
|
+
activeThemeId: themeId,
|
|
139
|
+
mods: {},
|
|
140
|
+
isPreview: false,
|
|
141
|
+
siteMeta: setting_1.DEFAULT_SITE_META,
|
|
142
|
+
...partial,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async function fetchVisitorContext(api, options) {
|
|
146
|
+
if (!api?.setting?.findAll) {
|
|
147
|
+
throw new Error('fetchVisitorContext: invalid ThemeApi instance');
|
|
148
|
+
}
|
|
149
|
+
return withApiRetry(async () => {
|
|
150
|
+
const row = (0, setting_1.unwrapSetting)(await api.setting.findAll());
|
|
151
|
+
const localeState = (0, locale_1.parseSiteLocale)(row?.i18n, {
|
|
152
|
+
locale: options.locale,
|
|
153
|
+
fallbackLocale: options.fallbackLocale,
|
|
154
|
+
preferredLocale: options.preferredLocale,
|
|
155
|
+
acceptLanguage: options.acceptLanguage,
|
|
156
|
+
});
|
|
157
|
+
const globalSetting = (0, json_1.safeJsonParse)(row?.globalSetting, {});
|
|
158
|
+
const runtime = (0, runtime_1.resolveThemeRuntime)(globalSetting, {
|
|
159
|
+
themeId: options.themeId,
|
|
160
|
+
honorPreview: options.honorPreview,
|
|
161
|
+
});
|
|
162
|
+
const siteMeta = (0, setting_1.parseSiteMeta)(row);
|
|
163
|
+
return {
|
|
164
|
+
locale: localeState.locale,
|
|
165
|
+
locales: localeState.locales,
|
|
166
|
+
messages: localeState.messages,
|
|
167
|
+
catalog: localeState.catalog,
|
|
168
|
+
themeId: runtime.themeId,
|
|
169
|
+
activeThemeId: runtime.activeThemeId,
|
|
170
|
+
mods: runtime.mods,
|
|
171
|
+
isPreview: runtime.isPreview,
|
|
172
|
+
siteMeta,
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/** Common site meta from the Setting row (`systemTitle`, `systemSubTitle`, …). */
|
|
177
|
+
async function fetchSiteMeta(api) {
|
|
178
|
+
return withApiRetry(async () => {
|
|
179
|
+
const row = (0, setting_1.unwrapSetting)(await api.setting.findAll());
|
|
180
|
+
return (0, setting_1.parseSiteMeta)(row);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/** Category archive — `getStaticProps` for `pages/category/[category].tsx`. */
|
|
184
|
+
async function fetchCategoryArchive(api, category) {
|
|
185
|
+
const [articlesResponse, categoriesResponse] = await Promise.all([
|
|
186
|
+
api.article.findArticlesByCategory(category),
|
|
187
|
+
api.category.findAll(),
|
|
188
|
+
]);
|
|
189
|
+
return {
|
|
190
|
+
category,
|
|
191
|
+
articles: (0, api_data_1.unpackPaginated)(articlesResponse),
|
|
192
|
+
categories: (0, api_data_1.unpackList)(categoriesResponse),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/** Tag archive — `getStaticProps` for `pages/tag/[tag].tsx`. */
|
|
196
|
+
async function fetchTagArchive(api, tag) {
|
|
197
|
+
const [articlesResponse, tagsResponse] = await Promise.all([
|
|
198
|
+
api.article.findArticlesByTag(tag),
|
|
199
|
+
api.tag.findAll(),
|
|
200
|
+
]);
|
|
201
|
+
return {
|
|
202
|
+
tag,
|
|
203
|
+
articles: (0, api_data_1.unpackPaginated)(articlesResponse),
|
|
204
|
+
tags: (0, api_data_1.unpackList)(tagsResponse),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/** Single article — `getStaticProps` for `pages/article/[id].tsx`. */
|
|
208
|
+
async function fetchSingleArticle(api, id) {
|
|
209
|
+
const articleResponse = await api.article.findById(id);
|
|
210
|
+
return { article: (0, api_data_1.unpackOne)(articleResponse) };
|
|
211
|
+
}
|
|
212
|
+
/** Site search — `getServerSideProps` / `getStaticProps` helper. */
|
|
213
|
+
async function fetchSearchArticles(api, keyword) {
|
|
214
|
+
if (!keyword.trim()) {
|
|
215
|
+
return { query: '', articles: [] };
|
|
216
|
+
}
|
|
217
|
+
const searchResponse = await api.search.searchArticle({
|
|
218
|
+
query: { keyword: keyword.trim() },
|
|
219
|
+
});
|
|
220
|
+
return {
|
|
221
|
+
query: keyword.trim(),
|
|
222
|
+
articles: (0, api_data_1.unpackList)(searchResponse),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Wrap `getStaticProps` fetchers with consistent logging and ISR fallback props.
|
|
227
|
+
*/
|
|
228
|
+
async function withThemeStaticProps(label, fetchFn, fallback) {
|
|
229
|
+
const reactPress = await resolveStaticVisitorContext();
|
|
230
|
+
try {
|
|
231
|
+
const data = await withApiRetry(fetchFn);
|
|
232
|
+
return themeStaticProps({ ...data, reactPress });
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
console.error(`[reactpress] ${label}`, error);
|
|
236
|
+
const props = typeof fallback === 'function' ? fallback(error) : fallback;
|
|
237
|
+
return themeStaticProps({ ...props, reactPress });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** Factory for category/tag archive pages — removes duplicated `getStaticProps` boilerplate. */
|
|
241
|
+
function createArchiveGetStaticProps(kind, fetchArchive, emptyFallback) {
|
|
242
|
+
return async (ctx) => {
|
|
243
|
+
const slug = ctx.params?.[kind];
|
|
244
|
+
if (typeof slug !== 'string' || !slug)
|
|
245
|
+
return (0, static_1.themeNotFound)();
|
|
246
|
+
return withThemeStaticProps(`fetch ${kind} archive failed`, () => fetchArchive(api_1.themeApi, slug), () => emptyFallback(slug));
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/** Standard on-demand article page props. */
|
|
250
|
+
async function fetchArticlePageProps(api, id) {
|
|
251
|
+
if (!id)
|
|
252
|
+
return { article: null };
|
|
253
|
+
const data = await fetchSingleArticle(api, id);
|
|
254
|
+
const article = data.article ?? null;
|
|
255
|
+
if (!article)
|
|
256
|
+
return { article: null };
|
|
257
|
+
return {
|
|
258
|
+
article: {
|
|
259
|
+
...article,
|
|
260
|
+
html: article.html ? (0, assets_1.rewriteArticleHtmlAssets)(article.html) : article.html,
|
|
261
|
+
cover: article.cover ? (0, assets_1.resolvePublicAssetUrl)(article.cover) : article.cover,
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pickSiteSettings = exports.formatPublishDateShort = exports.formatPublishDate = void 0;
|
|
4
|
+
var date_1 = require("../../utils/date");
|
|
5
|
+
Object.defineProperty(exports, "formatPublishDate", { enumerable: true, get: function () { return date_1.formatPublishDate; } });
|
|
6
|
+
Object.defineProperty(exports, "formatPublishDateShort", { enumerable: true, get: function () { return date_1.formatPublishDateShort; } });
|
|
7
|
+
var setting_1 = require("../../utils/setting");
|
|
8
|
+
Object.defineProperty(exports, "pickSiteSettings", { enumerable: true, get: function () { return setting_1.pickSiteSettings; } });
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchHomePageProps = fetchHomePageProps;
|
|
4
|
+
exports.fetchCategoryArchivePageProps = fetchCategoryArchivePageProps;
|
|
5
|
+
exports.fetchTagArchivePageProps = fetchTagArchivePageProps;
|
|
6
|
+
exports.fetchArchivesPageProps = fetchArchivesPageProps;
|
|
7
|
+
exports.fetchKnowledgeIndexPageProps = fetchKnowledgeIndexPageProps;
|
|
8
|
+
exports.fetchKnowledgeBookPageProps = fetchKnowledgeBookPageProps;
|
|
9
|
+
exports.fetchKnowledgeChapterPageProps = fetchKnowledgeChapterPageProps;
|
|
10
|
+
exports.fetchSearchPageProps = fetchSearchPageProps;
|
|
11
|
+
exports.fetchCmsPageProps = fetchCmsPageProps;
|
|
12
|
+
exports.fetchArticleDetailProps = fetchArticleDetailProps;
|
|
13
|
+
const api_1 = require("../api/api");
|
|
14
|
+
const api_data_1 = require("../api/api-data");
|
|
15
|
+
const articleSlim_1 = require("../content/articleSlim");
|
|
16
|
+
const archiveSlim_1 = require("../content/archiveSlim");
|
|
17
|
+
const carouselArticles_1 = require("../content/carouselArticles");
|
|
18
|
+
const assets_1 = require("../content/assets");
|
|
19
|
+
const fetch_1 = require("./fetch");
|
|
20
|
+
const DEFAULT_PAGE_SIZE = 12;
|
|
21
|
+
function fallbackCategory(value) {
|
|
22
|
+
return { value, label: value };
|
|
23
|
+
}
|
|
24
|
+
function fallbackTag(value) {
|
|
25
|
+
return { value, label: value };
|
|
26
|
+
}
|
|
27
|
+
/** Home / blog index — first page of articles + carousel recommendations. */
|
|
28
|
+
async function fetchHomePageProps(api = api_1.themeApi, pageSize = DEFAULT_PAGE_SIZE) {
|
|
29
|
+
return (0, fetch_1.withApiRetry)(async () => {
|
|
30
|
+
const response = await api.article.findAll({
|
|
31
|
+
query: { page: 1, pageSize, status: 'publish' },
|
|
32
|
+
});
|
|
33
|
+
const [rawArticles, total] = (0, api_data_1.unpackPaginatedPair)(response);
|
|
34
|
+
const recommendedArticles = await (0, carouselArticles_1.resolveCarouselArticles)(rawArticles, {
|
|
35
|
+
fetchRecommended: async () => (0, api_data_1.unpackList)(await api.article.getRecommendArticles({})),
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
articles: (0, articleSlim_1.slimArticlesForList)(rawArticles),
|
|
39
|
+
total,
|
|
40
|
+
recommendedArticles,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** Category archive — paginated list with taxonomy metadata. */
|
|
45
|
+
async function fetchCategoryArchivePageProps(api, categoryValue, pageSize = DEFAULT_PAGE_SIZE) {
|
|
46
|
+
const [articlesResponse, categoryResponse] = await Promise.all([
|
|
47
|
+
api.article.findArticlesByCategory(categoryValue, {
|
|
48
|
+
query: { page: 1, pageSize, status: 'publish' },
|
|
49
|
+
}),
|
|
50
|
+
api.category.findById(categoryValue),
|
|
51
|
+
]);
|
|
52
|
+
const [rawArticles, total] = (0, api_data_1.unpackPaginatedPair)(articlesResponse);
|
|
53
|
+
const category = (0, api_data_1.unpackOne)(categoryResponse) ?? fallbackCategory(categoryValue);
|
|
54
|
+
return {
|
|
55
|
+
articles: (0, articleSlim_1.slimArticlesForList)(rawArticles),
|
|
56
|
+
total,
|
|
57
|
+
category,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** Tag archive — paginated list with taxonomy metadata. */
|
|
61
|
+
async function fetchTagArchivePageProps(api, tagValue, pageSize = DEFAULT_PAGE_SIZE) {
|
|
62
|
+
const [articlesResponse, tagResponse] = await Promise.all([
|
|
63
|
+
api.article.findArticlesByTag(tagValue, {
|
|
64
|
+
query: { page: 1, pageSize, status: 'publish' },
|
|
65
|
+
}),
|
|
66
|
+
api.tag.findById(tagValue),
|
|
67
|
+
]);
|
|
68
|
+
const [rawArticles, total] = (0, api_data_1.unpackPaginatedPair)(articlesResponse);
|
|
69
|
+
const tag = (0, api_data_1.unpackOne)(tagResponse) ?? fallbackTag(tagValue);
|
|
70
|
+
return {
|
|
71
|
+
articles: (0, articleSlim_1.slimArticlesForList)(rawArticles),
|
|
72
|
+
total,
|
|
73
|
+
tag,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Archives tree — year/month grouped article index. */
|
|
77
|
+
async function fetchArchivesPageProps(api = api_1.themeApi) {
|
|
78
|
+
const response = await api.article.getArchives({});
|
|
79
|
+
const raw = (0, api_data_1.unpackOne)(response) ??
|
|
80
|
+
response;
|
|
81
|
+
return {
|
|
82
|
+
articles: (0, archiveSlim_1.slimArchiveTree)(raw ?? {}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Knowledge library index — first page. */
|
|
86
|
+
async function fetchKnowledgeIndexPageProps(api = api_1.themeApi, pageSize = DEFAULT_PAGE_SIZE) {
|
|
87
|
+
const response = await api.knowledge.findAll({
|
|
88
|
+
query: { page: 1, pageSize, status: 'publish' },
|
|
89
|
+
});
|
|
90
|
+
const [books, total] = (0, api_data_1.unpackPaginatedPair)(response);
|
|
91
|
+
return { books, total };
|
|
92
|
+
}
|
|
93
|
+
/** Knowledge book detail with sibling books for sidebar. */
|
|
94
|
+
async function fetchKnowledgeBookPageProps(api, pId) {
|
|
95
|
+
const [bookResponse, listResponse] = await Promise.all([
|
|
96
|
+
api.knowledge.findById(pId),
|
|
97
|
+
api.knowledge.findAll({ query: { page: 1, pageSize: 6, status: 'publish' } }),
|
|
98
|
+
]);
|
|
99
|
+
const book = (0, api_data_1.unpackOne)(bookResponse);
|
|
100
|
+
const [allBooks] = (0, api_data_1.unpackPaginatedPair)(listResponse);
|
|
101
|
+
return {
|
|
102
|
+
pId,
|
|
103
|
+
book,
|
|
104
|
+
otherBooks: book ? allBooks.filter((item) => item.id !== book.id) : allBooks,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Knowledge chapter detail. */
|
|
108
|
+
async function fetchKnowledgeChapterPageProps(api, pId, id) {
|
|
109
|
+
const [bookResponse, chapterResponse] = await Promise.all([
|
|
110
|
+
api.knowledge.findById(pId),
|
|
111
|
+
api.knowledge.findById(id),
|
|
112
|
+
]);
|
|
113
|
+
return {
|
|
114
|
+
pId,
|
|
115
|
+
book: (0, api_data_1.unpackOne)(bookResponse),
|
|
116
|
+
id,
|
|
117
|
+
chapter: (0, api_data_1.unpackOne)(chapterResponse),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** Site search results for `/search?keyword=`. */
|
|
121
|
+
async function fetchSearchPageProps(api, keyword) {
|
|
122
|
+
const trimmed = keyword.trim();
|
|
123
|
+
if (!trimmed) {
|
|
124
|
+
return { keyword: '', articles: [] };
|
|
125
|
+
}
|
|
126
|
+
const response = await api.search.searchArticle({
|
|
127
|
+
query: { keyword: trimmed },
|
|
128
|
+
});
|
|
129
|
+
const articles = (0, api_data_1.unpackList)(response).filter((article) => article.status === 'publish');
|
|
130
|
+
return { keyword: trimmed, articles };
|
|
131
|
+
}
|
|
132
|
+
/** CMS static page by id or path slug (admin → 页面). */
|
|
133
|
+
async function fetchCmsPageProps(api, idOrPath) {
|
|
134
|
+
if (!idOrPath?.trim())
|
|
135
|
+
return { page: null };
|
|
136
|
+
const raw = (0, api_data_1.unpackOne)(await api.page.findById(idOrPath.trim()));
|
|
137
|
+
if (!raw || raw.status !== 'publish')
|
|
138
|
+
return { page: null };
|
|
139
|
+
return {
|
|
140
|
+
page: {
|
|
141
|
+
id: raw.id,
|
|
142
|
+
name: raw.name,
|
|
143
|
+
path: raw.path,
|
|
144
|
+
html: raw.html ? (0, assets_1.rewriteArticleHtmlAssets)(raw.html) : raw.html,
|
|
145
|
+
toc: raw.toc,
|
|
146
|
+
status: raw.status,
|
|
147
|
+
publishAt: raw.publishAt,
|
|
148
|
+
views: raw.views,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** Single article by id (full entity from API). */
|
|
153
|
+
async function fetchArticleDetailProps(api, id) {
|
|
154
|
+
return { article: (0, api_data_1.unpackOne)(await api.article.findById(id)) };
|
|
155
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_SITE_META = void 0;
|
|
4
|
+
exports.unwrapSetting = unwrapSetting;
|
|
5
|
+
exports.parseSiteMeta = parseSiteMeta;
|
|
6
|
+
const api_data_1 = require("../api/api-data");
|
|
7
|
+
/** Unwrap `setting.findAll()` — API returns a single Setting row in the envelope. */
|
|
8
|
+
function unwrapSetting(response) {
|
|
9
|
+
const data = (0, api_data_1.unpackOne)(response);
|
|
10
|
+
if (data && typeof data === 'object' && !Array.isArray(data)) {
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
if (response && typeof response === 'object' && !Array.isArray(response)) {
|
|
14
|
+
const maybe = response;
|
|
15
|
+
if ('i18n' in maybe || 'globalSetting' in maybe || 'systemTitle' in maybe) {
|
|
16
|
+
return maybe;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
exports.DEFAULT_SITE_META = {
|
|
22
|
+
siteName: 'ReactPress Site',
|
|
23
|
+
siteDescription: 'A ReactPress powered site',
|
|
24
|
+
};
|
|
25
|
+
/** Parse branding from an effective Setting row (mods overlay applied by API). */
|
|
26
|
+
function parseSiteMeta(row) {
|
|
27
|
+
if (!row) {
|
|
28
|
+
return { ...exports.DEFAULT_SITE_META };
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
siteName: String(row.systemTitle ?? 'ReactPress Site').trim() || exports.DEFAULT_SITE_META.siteName,
|
|
32
|
+
siteDescription: String(row.systemSubTitle ?? exports.DEFAULT_SITE_META.siteDescription).trim() ||
|
|
33
|
+
exports.DEFAULT_SITE_META.siteDescription,
|
|
34
|
+
siteKeywords: row.seoKeyword != null && String(row.seoKeyword).trim()
|
|
35
|
+
? String(row.seoKeyword).trim()
|
|
36
|
+
: undefined,
|
|
37
|
+
siteUrl: row.systemUrl != null ? String(row.systemUrl).trim() || undefined : undefined,
|
|
38
|
+
siteLogo: row.systemLogo != null && String(row.systemLogo).trim()
|
|
39
|
+
? String(row.systemLogo).trim()
|
|
40
|
+
: undefined,
|
|
41
|
+
siteFavicon: row.systemFavicon != null && String(row.systemFavicon).trim()
|
|
42
|
+
? String(row.systemFavicon).trim()
|
|
43
|
+
: undefined,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.slimAppBootstrapForRoute = slimAppBootstrapForRoute;
|
|
4
|
+
exports.createBootstrapSlimmer = createBootstrapSlimmer;
|
|
5
|
+
const i18n_1 = require("../visitor/i18n");
|
|
6
|
+
const DEFAULT_SETTING_OMIT_KEYS = [
|
|
7
|
+
'i18n',
|
|
8
|
+
'globalSetting',
|
|
9
|
+
'adminSystemUrl',
|
|
10
|
+
'oss',
|
|
11
|
+
'smtpHost',
|
|
12
|
+
'smtpPort',
|
|
13
|
+
'smtpUser',
|
|
14
|
+
'smtpPass',
|
|
15
|
+
'smtpFromUser',
|
|
16
|
+
'createAt',
|
|
17
|
+
'updateAt',
|
|
18
|
+
];
|
|
19
|
+
function slimTags(tags) {
|
|
20
|
+
return tags.map(({ id, label, value, articleCount }) => ({
|
|
21
|
+
id,
|
|
22
|
+
label,
|
|
23
|
+
value,
|
|
24
|
+
articleCount,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
function slimCategories(categories) {
|
|
28
|
+
return categories.map(({ value, label }) => ({ value, label }));
|
|
29
|
+
}
|
|
30
|
+
function slimPages(pages) {
|
|
31
|
+
return pages.map(({ path, name }) => ({ path, name }));
|
|
32
|
+
}
|
|
33
|
+
function slimSetting(setting, omitKeys) {
|
|
34
|
+
const next = { ...setting };
|
|
35
|
+
for (const key of omitKeys) {
|
|
36
|
+
delete next[key];
|
|
37
|
+
}
|
|
38
|
+
return next;
|
|
39
|
+
}
|
|
40
|
+
function defaultFullSiteConfigRoute(pathname) {
|
|
41
|
+
return pathname === '/nav' || pathname.startsWith('/nav/');
|
|
42
|
+
}
|
|
43
|
+
function resolveFullSiteConfigRoute(pathname, options) {
|
|
44
|
+
const matcher = options?.fullSiteConfigRoutes ?? defaultFullSiteConfigRoute;
|
|
45
|
+
return typeof matcher === 'function' ? matcher(pathname) : matcher.some((route) => {
|
|
46
|
+
if (route.endsWith('*')) {
|
|
47
|
+
const prefix = route.slice(0, -1);
|
|
48
|
+
return pathname === prefix || pathname.startsWith(prefix);
|
|
49
|
+
}
|
|
50
|
+
return pathname === route || pathname.startsWith(`${route}/`);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Shrink `_app` SSR payload — drop duplicate JSON blobs and heavy site config on list pages. */
|
|
54
|
+
function slimAppBootstrapForRoute(bootstrap, pathname, options) {
|
|
55
|
+
const fullSiteConfig = resolveFullSiteConfigRoute(pathname, options);
|
|
56
|
+
const omitKeys = options?.settingOmitKeys ?? DEFAULT_SETTING_OMIT_KEYS;
|
|
57
|
+
let siteConfig = bootstrap.siteConfig;
|
|
58
|
+
if (!fullSiteConfig) {
|
|
59
|
+
siteConfig = bootstrap.siteConfig?.header ? { header: bootstrap.siteConfig.header } : {};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...bootstrap,
|
|
63
|
+
setting: slimSetting(bootstrap.setting, omitKeys),
|
|
64
|
+
tags: slimTags(bootstrap.tags),
|
|
65
|
+
categories: slimCategories(bootstrap.categories),
|
|
66
|
+
pages: slimPages(bootstrap.pages),
|
|
67
|
+
i18n: (0, i18n_1.slimVisitorI18nForSsr)(bootstrap.i18n, bootstrap.initialLocale),
|
|
68
|
+
siteConfig,
|
|
69
|
+
globalSetting: fullSiteConfig ? bootstrap.globalSetting : undefined,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Preset slimmer for catalog themes with `/nav` pages (Twenty Twenty-Five pattern). */
|
|
73
|
+
function createBootstrapSlimmer(options) {
|
|
74
|
+
return (bootstrap, pathname) => slimAppBootstrapForRoute(bootstrap, pathname, options);
|
|
75
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.themeOnDemandPaths = void 0;
|
|
4
|
+
exports.themeNotFound = themeNotFound;
|
|
5
|
+
exports.themeStaticNotFound = themeStaticNotFound;
|
|
6
|
+
const fetch_1 = require("./fetch");
|
|
7
|
+
/** WordPress-style on-demand ISR paths (`fallback: true`). */
|
|
8
|
+
exports.themeOnDemandPaths = {
|
|
9
|
+
paths: [],
|
|
10
|
+
fallback: true,
|
|
11
|
+
};
|
|
12
|
+
function themeNotFound() {
|
|
13
|
+
return { notFound: true };
|
|
14
|
+
}
|
|
15
|
+
function themeStaticNotFound(revalidate = fetch_1.THEME_ISR_REVALIDATE_SECONDS) {
|
|
16
|
+
return { notFound: true, revalidate };
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TEMPLATE_FILES = exports.ThemeTemplate = void 0;
|
|
4
|
+
exports.resolveTemplateFiles = resolveTemplateFiles;
|
|
5
|
+
/**
|
|
6
|
+
* WordPress-style template hierarchy → Next.js Pages Router paths.
|
|
7
|
+
* @see https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
8
|
+
*/
|
|
9
|
+
exports.ThemeTemplate = {
|
|
10
|
+
/** Site front page / blog index */
|
|
11
|
+
HOME: 'home',
|
|
12
|
+
/** Single post */
|
|
13
|
+
SINGLE: 'single',
|
|
14
|
+
/** Static page */
|
|
15
|
+
PAGE: 'page',
|
|
16
|
+
/** Category archive */
|
|
17
|
+
ARCHIVE_CATEGORY: 'archive-category',
|
|
18
|
+
/** Tag archive */
|
|
19
|
+
ARCHIVE_TAG: 'archive-tag',
|
|
20
|
+
/** Search results */
|
|
21
|
+
SEARCH: 'search',
|
|
22
|
+
/** Post archives by date */
|
|
23
|
+
ARCHIVES: 'archives',
|
|
24
|
+
/** Knowledge base index */
|
|
25
|
+
KNOWLEDGE: 'knowledge',
|
|
26
|
+
/** URL navigation hub */
|
|
27
|
+
NAV: 'nav',
|
|
28
|
+
/** Login page */
|
|
29
|
+
LOGIN: 'login',
|
|
30
|
+
/** 404 */
|
|
31
|
+
NOT_FOUND: '404',
|
|
32
|
+
};
|
|
33
|
+
/** Default file mapping (override in `theme.json` → `templates`). */
|
|
34
|
+
exports.DEFAULT_TEMPLATE_FILES = {
|
|
35
|
+
[exports.ThemeTemplate.HOME]: 'pages/index.tsx',
|
|
36
|
+
[exports.ThemeTemplate.SINGLE]: 'pages/article/[id].tsx',
|
|
37
|
+
[exports.ThemeTemplate.PAGE]: 'pages/[path].tsx',
|
|
38
|
+
[exports.ThemeTemplate.ARCHIVE_CATEGORY]: 'pages/category/[category].tsx',
|
|
39
|
+
[exports.ThemeTemplate.ARCHIVE_TAG]: 'pages/tag/[tag].tsx',
|
|
40
|
+
[exports.ThemeTemplate.SEARCH]: 'pages/search.tsx',
|
|
41
|
+
[exports.ThemeTemplate.ARCHIVES]: 'pages/archives/index.tsx',
|
|
42
|
+
[exports.ThemeTemplate.KNOWLEDGE]: 'pages/knowledge/index.tsx',
|
|
43
|
+
[exports.ThemeTemplate.NAV]: 'pages/nav/index.tsx',
|
|
44
|
+
[exports.ThemeTemplate.LOGIN]: 'pages/login/index.tsx',
|
|
45
|
+
[exports.ThemeTemplate.NOT_FOUND]: 'pages/404.tsx',
|
|
46
|
+
};
|
|
47
|
+
function resolveTemplateFiles(manifest) {
|
|
48
|
+
const custom = manifest?.templates ?? {};
|
|
49
|
+
return { ...exports.DEFAULT_TEMPLATE_FILES, ...custom };
|
|
50
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.themeOnDemandPaths = void 0;
|
|
4
|
+
exports.themeNotFound = themeNotFound;
|
|
5
|
+
exports.themeStaticNotFound = themeStaticNotFound;
|
|
6
|
+
const fetch_1 = require("./fetch");
|
|
7
|
+
/** WordPress-style on-demand ISR paths (`fallback: true`). */
|
|
8
|
+
exports.themeOnDemandPaths = {
|
|
9
|
+
paths: [],
|
|
10
|
+
fallback: true,
|
|
11
|
+
};
|
|
12
|
+
function themeNotFound() {
|
|
13
|
+
return { notFound: true };
|
|
14
|
+
}
|
|
15
|
+
function themeStaticNotFound(revalidate = fetch_1.THEME_ISR_REVALIDATE_SECONDS) {
|
|
16
|
+
return { notFound: true, revalidate };
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TEMPLATE_FILES = exports.ThemeTemplate = void 0;
|
|
4
|
+
exports.resolveTemplateFiles = resolveTemplateFiles;
|
|
5
|
+
/**
|
|
6
|
+
* WordPress-style template hierarchy → Next.js Pages Router paths.
|
|
7
|
+
* @see https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
8
|
+
*/
|
|
9
|
+
exports.ThemeTemplate = {
|
|
10
|
+
/** Site front page / blog index */
|
|
11
|
+
HOME: 'home',
|
|
12
|
+
/** Single post */
|
|
13
|
+
SINGLE: 'single',
|
|
14
|
+
/** Static page */
|
|
15
|
+
PAGE: 'page',
|
|
16
|
+
/** Category archive */
|
|
17
|
+
ARCHIVE_CATEGORY: 'archive-category',
|
|
18
|
+
/** Tag archive */
|
|
19
|
+
ARCHIVE_TAG: 'archive-tag',
|
|
20
|
+
/** Search results */
|
|
21
|
+
SEARCH: 'search',
|
|
22
|
+
/** 404 */
|
|
23
|
+
NOT_FOUND: '404',
|
|
24
|
+
};
|
|
25
|
+
/** Default file mapping (override in `theme.json` → `templates`). */
|
|
26
|
+
exports.DEFAULT_TEMPLATE_FILES = {
|
|
27
|
+
[exports.ThemeTemplate.HOME]: 'pages/index.tsx',
|
|
28
|
+
[exports.ThemeTemplate.SINGLE]: 'pages/article/[id].tsx',
|
|
29
|
+
[exports.ThemeTemplate.PAGE]: 'pages/about.tsx',
|
|
30
|
+
[exports.ThemeTemplate.ARCHIVE_CATEGORY]: 'pages/category/[category].tsx',
|
|
31
|
+
[exports.ThemeTemplate.ARCHIVE_TAG]: 'pages/tag/[tag].tsx',
|
|
32
|
+
[exports.ThemeTemplate.SEARCH]: 'pages/search.tsx',
|
|
33
|
+
[exports.ThemeTemplate.NOT_FOUND]: 'pages/404.tsx',
|
|
34
|
+
};
|
|
35
|
+
function resolveTemplateFiles(manifest) {
|
|
36
|
+
const custom = manifest?.templates ?? {};
|
|
37
|
+
return { ...exports.DEFAULT_TEMPLATE_FILES, ...custom };
|
|
38
|
+
}
|