@fecommunity/reactpress 4.0.0-beta.0 → 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 -482
- 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 +117 -66
- 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 +184 -52
- 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/project-type.js +18 -0
- 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 +199 -125
- package/out/ui/prompts.js +91 -0
- 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-revision.entity.js +1 -1
- 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/node-polyfills.js +24 -0
- 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/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/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
|
@@ -8,6 +8,7 @@ exports.waitForDatabase = waitForDatabase;
|
|
|
8
8
|
exports.parseDockerPublishedPort = parseDockerPublishedPort;
|
|
9
9
|
exports.getContainerPublishedHostPort = getContainerPublishedHostPort;
|
|
10
10
|
exports.ensureDatabaseHostPort = ensureDatabaseHostPort;
|
|
11
|
+
exports.promoteToSqliteMode = promoteToSqliteMode;
|
|
11
12
|
exports.startEmbeddedDatabase = startEmbeddedDatabase;
|
|
12
13
|
exports.stopEmbeddedDatabase = stopEmbeddedDatabase;
|
|
13
14
|
exports.ensureDatabase = ensureDatabase;
|
|
@@ -89,7 +90,7 @@ async function buildConnectionFailureMessage(projectRoot, config, creds) {
|
|
|
89
90
|
const healthy = await isContainerHealthy(containerName);
|
|
90
91
|
if (rootReachable && healthy) {
|
|
91
92
|
return (`数据库容器已在端口 ${port} 运行,但账号「${creds.user}」无法连接(数据卷中的凭证与 .env 不一致)。` +
|
|
92
|
-
` 请在项目目录执行: cd .reactpress && docker compose down -v && cd .. && reactpress
|
|
93
|
+
` 请在项目目录执行: cd .reactpress && docker compose down -v && cd .. && reactpress init --force`);
|
|
93
94
|
}
|
|
94
95
|
return `数据库容器已启动,但连接超时。请执行 docker logs ${containerName} 查看详情。`;
|
|
95
96
|
}
|
|
@@ -164,18 +165,26 @@ function runDockerCompose(composeFile, cwd, subcommand, env) {
|
|
|
164
165
|
env,
|
|
165
166
|
});
|
|
166
167
|
}
|
|
168
|
+
async function promoteToSqliteMode(projectRoot, config) {
|
|
169
|
+
const { sqlitePath } = (0, paths_1.getProjectPaths)(projectRoot);
|
|
170
|
+
const next = structuredClone(config);
|
|
171
|
+
next.database.mode = 'embedded-sqlite';
|
|
172
|
+
next.database.sqlitePath = config.database.sqlitePath ?? sqlitePath;
|
|
173
|
+
await (0, config_1.saveConfig)(projectRoot, next);
|
|
174
|
+
await (0, config_1.syncEnvFromConfig)(projectRoot, next);
|
|
175
|
+
console.log('[reactpress] Switched to SQLite zero-dependency mode (no Docker/nginx required)');
|
|
176
|
+
return (0, sqlite_1.ensureSqliteDatabase)(projectRoot);
|
|
177
|
+
}
|
|
167
178
|
async function startEmbeddedDatabase(projectRoot, config) {
|
|
168
179
|
if ((0, config_1.isSqliteMode)(config)) {
|
|
180
|
+
await (0, config_1.syncEnvFromConfig)(projectRoot, config);
|
|
169
181
|
return (0, sqlite_1.ensureSqliteDatabase)(projectRoot);
|
|
170
182
|
}
|
|
171
183
|
if (config.database.mode !== 'embedded-docker') {
|
|
172
184
|
return { ok: true };
|
|
173
185
|
}
|
|
174
186
|
if (!(0, exec_1.isDockerAvailable)()) {
|
|
175
|
-
return
|
|
176
|
-
ok: false,
|
|
177
|
-
message: '未检测到 Docker。请安装并启动 Docker,或将 database.mode 设为 external / embedded-sqlite。',
|
|
178
|
-
};
|
|
187
|
+
return promoteToSqliteMode(projectRoot, config);
|
|
179
188
|
}
|
|
180
189
|
const { dockerComposePath, reactpressDir } = (0, paths_1.getProjectPaths)(projectRoot);
|
|
181
190
|
const maxPortRetries = 5;
|
|
@@ -217,6 +226,7 @@ async function stopEmbeddedDatabase(projectRoot, config) {
|
|
|
217
226
|
}
|
|
218
227
|
async function ensureDatabase(projectRoot, config) {
|
|
219
228
|
if ((0, config_1.isSqliteMode)(config)) {
|
|
229
|
+
await (0, config_1.syncEnvFromConfig)(projectRoot, config);
|
|
220
230
|
return (0, sqlite_1.ensureSqliteDatabase)(projectRoot);
|
|
221
231
|
}
|
|
222
232
|
const creds = await (0, mysql_1.getDatabaseCredentials)(projectRoot);
|
|
@@ -224,6 +234,9 @@ async function ensureDatabase(projectRoot, config) {
|
|
|
224
234
|
return { ok: true };
|
|
225
235
|
}
|
|
226
236
|
if (config.database.mode === 'embedded-docker') {
|
|
237
|
+
if (!(0, exec_1.isDockerAvailable)()) {
|
|
238
|
+
return promoteToSqliteMode(projectRoot, config);
|
|
239
|
+
}
|
|
227
240
|
return startEmbeddedDatabase(projectRoot, config);
|
|
228
241
|
}
|
|
229
242
|
return {
|
|
@@ -12,16 +12,39 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
12
12
|
const node_path_1 = __importDefault(require("node:path"));
|
|
13
13
|
const paths_1 = require("../../utils/paths");
|
|
14
14
|
const config_1 = require("../config");
|
|
15
|
+
const LEGACY_SQLITE_REL_PATH = node_path_1.default.join('data', 'reactpress.db');
|
|
16
|
+
async function maybeMigrateLegacySqlite(projectRoot, targetPath) {
|
|
17
|
+
const legacyPath = node_path_1.default.join(projectRoot, LEGACY_SQLITE_REL_PATH);
|
|
18
|
+
const normalizedTarget = node_path_1.default.resolve(projectRoot, targetPath);
|
|
19
|
+
const normalizedLegacy = node_path_1.default.resolve(legacyPath);
|
|
20
|
+
if (normalizedLegacy === normalizedTarget)
|
|
21
|
+
return;
|
|
22
|
+
if (!(await fs_extra_1.default.pathExists(legacyPath)))
|
|
23
|
+
return;
|
|
24
|
+
if (await fs_extra_1.default.pathExists(normalizedTarget))
|
|
25
|
+
return;
|
|
26
|
+
await fs_extra_1.default.ensureDir(node_path_1.default.dirname(normalizedTarget));
|
|
27
|
+
await fs_extra_1.default.copyFile(legacyPath, normalizedTarget);
|
|
28
|
+
console.log(`[reactpress] Migrated SQLite database: ${LEGACY_SQLITE_REL_PATH} → ${node_path_1.default.relative(projectRoot, normalizedTarget) || paths_1.SQLITE_REL_PATH}`);
|
|
29
|
+
}
|
|
15
30
|
async function resolveSqlitePath(projectRoot, override) {
|
|
16
31
|
const paths = (0, paths_1.getProjectPaths)(projectRoot);
|
|
17
|
-
if (override)
|
|
18
|
-
|
|
32
|
+
if (override) {
|
|
33
|
+
const resolved = node_path_1.default.resolve(projectRoot, override);
|
|
34
|
+
await maybeMigrateLegacySqlite(projectRoot, resolved);
|
|
35
|
+
return resolved;
|
|
36
|
+
}
|
|
19
37
|
if (await fs_extra_1.default.pathExists(paths.envPath)) {
|
|
20
38
|
const env = await (0, config_1.loadEnvFile)(paths.envPath);
|
|
21
|
-
if (env.DB_DATABASE)
|
|
22
|
-
|
|
39
|
+
if (env.DB_DATABASE) {
|
|
40
|
+
const resolved = node_path_1.default.resolve(projectRoot, env.DB_DATABASE);
|
|
41
|
+
await maybeMigrateLegacySqlite(projectRoot, resolved);
|
|
42
|
+
return resolved;
|
|
43
|
+
}
|
|
23
44
|
}
|
|
24
|
-
|
|
45
|
+
const target = paths.sqlitePath;
|
|
46
|
+
await maybeMigrateLegacySqlite(projectRoot, target);
|
|
47
|
+
return target;
|
|
25
48
|
}
|
|
26
49
|
async function getSqliteCredentials(projectRoot) {
|
|
27
50
|
const database = await resolveSqlitePath(projectRoot);
|
|
@@ -1,60 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.initProject = initProject;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
const paths_1 = require("../utils/paths");
|
|
10
|
-
const config_1 = require("./config");
|
|
11
|
-
const database_1 = require("./database");
|
|
12
4
|
const local_site_1 = require("./local-site");
|
|
13
5
|
async function initProject(options) {
|
|
14
|
-
|
|
15
|
-
return (0, local_site_1.initLocalProject)(options.directory, { force: options.force });
|
|
16
|
-
}
|
|
17
|
-
const projectRoot = options.directory;
|
|
18
|
-
const paths = (0, paths_1.getProjectPaths)(projectRoot);
|
|
19
|
-
if ((await fs_extra_1.default.pathExists(paths.configPath)) && !options.force) {
|
|
20
|
-
return {
|
|
21
|
-
ok: false,
|
|
22
|
-
projectRoot,
|
|
23
|
-
message: '目录已是 ReactPress 项目。使用 --force 覆盖配置。',
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
await fs_extra_1.default.ensureDir(projectRoot);
|
|
27
|
-
await fs_extra_1.default.ensureDir(paths.reactpressDir);
|
|
28
|
-
const templatesDir = (0, paths_1.getTemplatesDir)();
|
|
29
|
-
await copyTemplate((0, node_path_1.join)(templatesDir, 'docker-compose.yml'), paths.dockerComposePath);
|
|
30
|
-
await copyTemplate((0, node_path_1.join)(templatesDir, 'package.json'), (0, node_path_1.join)(projectRoot, 'package.json'));
|
|
31
|
-
const config = (await fs_extra_1.default.readJson((0, node_path_1.join)(templatesDir, 'config.default.json')));
|
|
32
|
-
await (0, config_1.saveConfig)(projectRoot, config);
|
|
33
|
-
await (0, config_1.syncEnvFromConfig)(projectRoot, config);
|
|
34
|
-
if (!(await fs_extra_1.default.pathExists(paths.envPath)) || options.force) {
|
|
35
|
-
const envTemplate = await fs_extra_1.default.readFile((0, node_path_1.join)(templatesDir, 'env.default'), 'utf8');
|
|
36
|
-
await fs_extra_1.default.writeFile(paths.envPath, envTemplate, 'utf8');
|
|
37
|
-
await (0, config_1.syncEnvFromConfig)(projectRoot, config);
|
|
38
|
-
}
|
|
39
|
-
await (0, database_1.ensureDatabaseHostPort)(projectRoot, undefined, config);
|
|
40
|
-
const dbResult = await (0, database_1.ensureDatabase)(projectRoot, config);
|
|
41
|
-
if (!dbResult.ok) {
|
|
42
|
-
return {
|
|
43
|
-
ok: true,
|
|
44
|
-
projectRoot,
|
|
45
|
-
message: `项目已创建,但数据库未就绪: ${dbResult.message}。可稍后运行 reactpress dev。`,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
ok: true,
|
|
50
|
-
projectRoot,
|
|
51
|
-
message: 'ReactPress 项目初始化完成。运行 reactpress dev 启动服务。',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
async function copyTemplate(src, dest) {
|
|
55
|
-
if (!(await fs_extra_1.default.pathExists(src))) {
|
|
56
|
-
throw new Error(`模板文件缺失: ${src}`);
|
|
57
|
-
}
|
|
58
|
-
await fs_extra_1.default.copy(src, dest, { overwrite: true });
|
|
6
|
+
return (0, local_site_1.initLocalProject)(options.directory, { force: options.force });
|
|
59
7
|
}
|
|
60
8
|
//# sourceMappingURL=init.js.map
|
|
@@ -11,26 +11,25 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
11
11
|
const paths_1 = require("../utils/paths");
|
|
12
12
|
const config_1 = require("../services/config");
|
|
13
13
|
function getLocalSitePaths(siteRoot) {
|
|
14
|
-
const
|
|
14
|
+
const reactpressDir = node_path_1.default.join(siteRoot, paths_1.CONFIG_DIR);
|
|
15
15
|
return {
|
|
16
16
|
siteRoot,
|
|
17
|
-
dataDir,
|
|
17
|
+
dataDir: reactpressDir,
|
|
18
18
|
uploadsDir: node_path_1.default.join(siteRoot, 'uploads'),
|
|
19
|
-
dbPath: node_path_1.default.join(
|
|
19
|
+
dbPath: node_path_1.default.join(reactpressDir, 'reactpress.db'),
|
|
20
20
|
envPath: node_path_1.default.join(siteRoot, '.env'),
|
|
21
|
-
reactpressDir
|
|
21
|
+
reactpressDir,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
function ensureLocalSite(siteRoot, port, options = {}) {
|
|
25
25
|
const paths = getLocalSitePaths(siteRoot);
|
|
26
|
-
fs_extra_1.default.mkdirSync(paths.dataDir, { recursive: true });
|
|
27
|
-
fs_extra_1.default.mkdirSync(paths.uploadsDir, { recursive: true });
|
|
28
26
|
fs_extra_1.default.mkdirSync(paths.reactpressDir, { recursive: true });
|
|
27
|
+
fs_extra_1.default.mkdirSync(paths.uploadsDir, { recursive: true });
|
|
29
28
|
const siteUrl = `http://127.0.0.1:${port}`;
|
|
30
29
|
const clientSiteUrl = 'http://localhost:3001';
|
|
31
30
|
const envLines = [
|
|
32
31
|
'DB_TYPE=sqlite',
|
|
33
|
-
`DB_DATABASE=${
|
|
32
|
+
`DB_DATABASE=${paths_1.SQLITE_REL_PATH}`,
|
|
34
33
|
`SERVER_PORT=${port}`,
|
|
35
34
|
`SERVER_SITE_URL=${siteUrl}`,
|
|
36
35
|
`CLIENT_SITE_URL=${clientSiteUrl}`,
|
|
@@ -49,7 +48,7 @@ function ensureLocalSite(siteRoot, port, options = {}) {
|
|
|
49
48
|
if (!fs_extra_1.default.existsSync(configPath)) {
|
|
50
49
|
const config = {
|
|
51
50
|
version: 1,
|
|
52
|
-
database: { mode: 'embedded-sqlite', sqlitePath:
|
|
51
|
+
database: { mode: 'embedded-sqlite', sqlitePath: paths_1.SQLITE_REL_PATH },
|
|
53
52
|
server: {
|
|
54
53
|
port,
|
|
55
54
|
apiPrefix: '/api',
|
|
@@ -127,18 +126,24 @@ async function initLocalProject(projectRoot, options = {}) {
|
|
|
127
126
|
return {
|
|
128
127
|
ok: false,
|
|
129
128
|
projectRoot,
|
|
130
|
-
message: '目录已是 ReactPress 项目。使用 --force
|
|
129
|
+
message: '目录已是 ReactPress 项目。使用 --force 覆盖配置。',
|
|
131
130
|
};
|
|
132
131
|
}
|
|
133
132
|
await fs_extra_1.default.ensureDir(projectRoot);
|
|
134
133
|
ensureLocalSite(projectRoot, port);
|
|
134
|
+
const templatesDir = (0, paths_1.getTemplatesDir)();
|
|
135
|
+
const pkgTemplate = node_path_1.default.join(templatesDir, 'package.json');
|
|
136
|
+
const pkgDest = node_path_1.default.join(projectRoot, 'package.json');
|
|
137
|
+
if ((await fs_extra_1.default.pathExists(pkgTemplate)) && (!(await fs_extra_1.default.pathExists(pkgDest)) || options.force)) {
|
|
138
|
+
await fs_extra_1.default.copy(pkgTemplate, pkgDest, { overwrite: true });
|
|
139
|
+
}
|
|
135
140
|
const config = (await fs_extra_1.default.readJson(paths.configPath));
|
|
136
141
|
await (0, config_1.saveConfig)(projectRoot, config);
|
|
137
142
|
await (0, config_1.syncEnvFromConfig)(projectRoot, config);
|
|
138
143
|
return {
|
|
139
144
|
ok: true,
|
|
140
145
|
projectRoot,
|
|
141
|
-
message: 'ReactPress
|
|
146
|
+
message: 'ReactPress 项目初始化完成。',
|
|
142
147
|
};
|
|
143
148
|
}
|
|
144
149
|
//# sourceMappingURL=local-site.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ensureDefaultTheme = ensureDefaultTheme;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
function writeActiveThemeManifest(projectRoot, themeId, themeDir) {
|
|
10
|
+
const manifestPath = node_path_1.default.join(projectRoot, '.reactpress', 'active-theme.json');
|
|
11
|
+
const themeDirRel = node_path_1.default.relative(projectRoot, themeDir);
|
|
12
|
+
fs_extra_1.default.mkdirSync(node_path_1.default.dirname(manifestPath), { recursive: true });
|
|
13
|
+
fs_extra_1.default.writeFileSync(manifestPath, JSON.stringify({
|
|
14
|
+
activeTheme: themeId,
|
|
15
|
+
themeDir: themeDirRel,
|
|
16
|
+
updatedAt: new Date().toISOString(),
|
|
17
|
+
}, null, 2), 'utf8');
|
|
18
|
+
}
|
|
19
|
+
/** Install catalog featured theme when no resolvable theme exists (npm standalone init). */
|
|
20
|
+
async function ensureDefaultTheme(projectRoot) {
|
|
21
|
+
const { hasResolvableActiveTheme, } = require('../../lib/theme-runtime');
|
|
22
|
+
const { installThemeFromNpm } = require('../../lib/theme-install');
|
|
23
|
+
const { readThemeCatalog } = require('../../lib/theme-registry');
|
|
24
|
+
const { t } = require('../../lib/i18n');
|
|
25
|
+
const root = node_path_1.default.resolve(projectRoot);
|
|
26
|
+
if (hasResolvableActiveTheme(root)) {
|
|
27
|
+
return { installed: false, skipped: true };
|
|
28
|
+
}
|
|
29
|
+
const catalog = readThemeCatalog(root);
|
|
30
|
+
const featured = catalog.themes.find((entry) => entry.featured && entry.npm) ?? catalog.themes.find((entry) => entry.npm);
|
|
31
|
+
if (!featured?.npm) {
|
|
32
|
+
return { installed: false, error: 'NO_CATALOG_THEME' };
|
|
33
|
+
}
|
|
34
|
+
console.log(t('themeInstall.installing', { spec: featured.npm }));
|
|
35
|
+
try {
|
|
36
|
+
const result = await installThemeFromNpm(root, featured.npm);
|
|
37
|
+
writeActiveThemeManifest(root, result.themeId, result.themeDir);
|
|
38
|
+
console.log(t('themeInstall.success', {
|
|
39
|
+
name: featured.name ?? result.themeId,
|
|
40
|
+
id: result.themeId,
|
|
41
|
+
dir: node_path_1.default.relative(root, result.themeDir),
|
|
42
|
+
}));
|
|
43
|
+
return { installed: true, themeId: result.themeId };
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
47
|
+
return { installed: false, error: message };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=theme-bootstrap.js.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderEnvFile = renderEnvFile;
|
|
4
|
+
const SQLITE_SECTIONS = [
|
|
5
|
+
{
|
|
6
|
+
header: '# ── 数据库 ──',
|
|
7
|
+
keys: [
|
|
8
|
+
{ key: 'DB_TYPE', comment: '# 数据库类型:sqlite(本地文件,默认)或 mysql' },
|
|
9
|
+
{ key: 'DB_DATABASE', comment: '# SQLite 文件路径,或 MySQL 库名' },
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
header: '# ── 服务 ──',
|
|
14
|
+
keys: [
|
|
15
|
+
{ key: 'SERVER_PORT', comment: '# 后台 API 监听端口' },
|
|
16
|
+
{ key: 'SERVER_SITE_URL', comment: '# 后台 API 对外 URL(OpenAPI、媒体链接等)' },
|
|
17
|
+
{ key: 'CLIENT_SITE_URL', comment: '# 前台站点 URL(主题 / Next.js 访客端)' },
|
|
18
|
+
{ key: 'SERVER_API_PREFIX', comment: '# REST API 路径前缀' },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
header: '# ── 存储与安装 ──',
|
|
23
|
+
keys: [
|
|
24
|
+
{ key: 'REACTPRESS_UPLOAD_DIR', comment: '# 上传文件保存目录(相对或绝对路径)' },
|
|
25
|
+
{ key: 'ADMIN_USER', comment: '# 安装向导默认管理员用户名(首次安装时使用)' },
|
|
26
|
+
{ key: 'ADMIN_PASSWD', comment: '# 安装向导默认管理员密码' },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
header: '# ── 其他 ──',
|
|
31
|
+
keys: [{ key: 'REACTPRESS_LANG', comment: '# CLI 与安装向导语言:zh | en' }],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
const MYSQL_SECTIONS = [
|
|
35
|
+
{
|
|
36
|
+
header: '# ── 数据库(MySQL)──',
|
|
37
|
+
keys: [
|
|
38
|
+
{ key: 'DB_TYPE', comment: '# 数据库类型:mysql 或 sqlite' },
|
|
39
|
+
{ key: 'DB_HOST', comment: '# MySQL 主机地址' },
|
|
40
|
+
{ key: 'DB_PORT', comment: '# MySQL 端口(Docker 映射端口以实际为准)' },
|
|
41
|
+
{ key: 'DB_USER', comment: '# MySQL 用户名' },
|
|
42
|
+
{ key: 'DB_PASSWD', comment: '# MySQL 密码' },
|
|
43
|
+
{ key: 'DB_DATABASE', comment: '# MySQL 库名' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
header: '# ── 服务 ──',
|
|
48
|
+
keys: [
|
|
49
|
+
{ key: 'SERVER_PORT', comment: '# 后台 API 监听端口' },
|
|
50
|
+
{ key: 'SERVER_SITE_URL', comment: '# 后台 API 对外 URL' },
|
|
51
|
+
{ key: 'CLIENT_SITE_URL', comment: '# 前台站点 URL' },
|
|
52
|
+
{ key: 'SERVER_API_PREFIX', comment: '# REST API 路径前缀' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
header: '# ── 存储 ──',
|
|
57
|
+
keys: [{ key: 'REACTPRESS_UPLOAD_DIR', comment: '# 上传文件保存目录' }],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
header: '# ── 其他 ──',
|
|
61
|
+
keys: [{ key: 'REACTPRESS_LANG', comment: '# CLI 与安装向导语言:zh | en' }],
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
function inferEnvMode(map) {
|
|
65
|
+
return map.DB_TYPE === 'mysql' ? 'mysql' : 'sqlite';
|
|
66
|
+
}
|
|
67
|
+
/** 将键值对格式化为带分区注释的 .env 文本。 */
|
|
68
|
+
function renderEnvFile(map, mode) {
|
|
69
|
+
const resolvedMode = mode ?? inferEnvMode(map);
|
|
70
|
+
const sections = resolvedMode === 'mysql' ? MYSQL_SECTIONS : SQLITE_SECTIONS;
|
|
71
|
+
const used = new Set();
|
|
72
|
+
const lines = [
|
|
73
|
+
'# ReactPress — 由 reactpress-cli 管理',
|
|
74
|
+
'# 修改后需重启服务;多数配置会随 .reactpress/config.json 同步',
|
|
75
|
+
'',
|
|
76
|
+
];
|
|
77
|
+
for (const section of sections) {
|
|
78
|
+
const sectionLines = [];
|
|
79
|
+
for (const { key, comment } of section.keys) {
|
|
80
|
+
if (map[key] === undefined)
|
|
81
|
+
continue;
|
|
82
|
+
sectionLines.push(comment, `${key}=${map[key]}`);
|
|
83
|
+
used.add(key);
|
|
84
|
+
}
|
|
85
|
+
if (sectionLines.length > 0) {
|
|
86
|
+
lines.push(section.header, ...sectionLines, '');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const extras = Object.entries(map).filter(([key]) => !used.has(key));
|
|
90
|
+
if (extras.length > 0) {
|
|
91
|
+
lines.push('# ── 扩展配置 ──');
|
|
92
|
+
for (const [key, value] of extras) {
|
|
93
|
+
lines.push(`${key}=${value}`);
|
|
94
|
+
}
|
|
95
|
+
lines.push('');
|
|
96
|
+
}
|
|
97
|
+
return `${lines.join('\n').replace(/\n+$/, '')}\n`;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=env-file.js.map
|
package/out/core/utils/paths.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENV_FILE = exports.PID_FILE = exports.CONFIG_FILE = exports.CONFIG_DIR = void 0;
|
|
3
|
+
exports.SQLITE_REL_PATH = exports.ENV_FILE = exports.PID_FILE = exports.CONFIG_FILE = exports.CONFIG_DIR = void 0;
|
|
4
4
|
exports.getPackageRoot = getPackageRoot;
|
|
5
5
|
exports.getTemplatesDir = getTemplatesDir;
|
|
6
6
|
exports.getProjectPaths = getProjectPaths;
|
|
@@ -9,6 +9,8 @@ exports.CONFIG_DIR = '.reactpress';
|
|
|
9
9
|
exports.CONFIG_FILE = 'config.json';
|
|
10
10
|
exports.PID_FILE = 'server.pid';
|
|
11
11
|
exports.ENV_FILE = '.env';
|
|
12
|
+
/** Relative SQLite file under project root (runtime data lives in `.reactpress/`). */
|
|
13
|
+
exports.SQLITE_REL_PATH = (0, node_path_1.join)(exports.CONFIG_DIR, 'reactpress.db');
|
|
12
14
|
/** CLI 包根目录(编译后位于 out/core/utils → ../../../) */
|
|
13
15
|
function getPackageRoot() {
|
|
14
16
|
return (0, node_path_1.join)(__dirname, '..', '..', '..');
|
|
@@ -18,7 +20,6 @@ function getTemplatesDir() {
|
|
|
18
20
|
}
|
|
19
21
|
function getProjectPaths(projectRoot) {
|
|
20
22
|
const reactpressDir = (0, node_path_1.join)(projectRoot, exports.CONFIG_DIR);
|
|
21
|
-
const dataDir = (0, node_path_1.join)(projectRoot, 'data');
|
|
22
23
|
return {
|
|
23
24
|
projectRoot,
|
|
24
25
|
reactpressDir,
|
|
@@ -26,8 +27,8 @@ function getProjectPaths(projectRoot) {
|
|
|
26
27
|
pidPath: (0, node_path_1.join)(reactpressDir, exports.PID_FILE),
|
|
27
28
|
envPath: (0, node_path_1.join)(projectRoot, exports.ENV_FILE),
|
|
28
29
|
dockerComposePath: (0, node_path_1.join)(reactpressDir, 'docker-compose.yml'),
|
|
29
|
-
dbDataDir:
|
|
30
|
-
sqlitePath: (0, node_path_1.join)(
|
|
30
|
+
dbDataDir: reactpressDir,
|
|
31
|
+
sqlitePath: (0, node_path_1.join)(reactpressDir, 'reactpress.db'),
|
|
31
32
|
uploadsDir: (0, node_path_1.join)(projectRoot, 'uploads'),
|
|
32
33
|
};
|
|
33
34
|
}
|
package/out/lib/api-dev.js
CHANGED
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const { spawn } = require('child_process');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const { ensureProjectEnvironment } = require('./bootstrap');
|
|
7
|
+
const { applyAutoLocalDevFallback } = require('./dev');
|
|
7
8
|
const { getServerBin, getServerDir, isUsingMonorepoServer, canStartLocalApi, } = require('./paths');
|
|
8
9
|
const { stopApi } = require('./lifecycle');
|
|
9
10
|
const { ensureOriginalCwd } = require('./root');
|
|
10
11
|
const { t } = require('./i18n');
|
|
11
12
|
const { ensureApiPortFree } = require('./ports');
|
|
12
13
|
const { ensureDevDatabase } = require('./docker');
|
|
14
|
+
const { ensureBundledServerDeps } = require('./server-bundle');
|
|
13
15
|
let apiChild;
|
|
14
16
|
function stopApiDev(projectRoot) {
|
|
15
17
|
if (apiChild && !apiChild.killed) {
|
|
@@ -59,12 +61,13 @@ async function runApiDev(projectRoot = ensureOriginalCwd()) {
|
|
|
59
61
|
const skipEnvBootstrap = process.env.REACTPRESS_DEV_DB_READY === '1';
|
|
60
62
|
if (!skipEnvBootstrap) {
|
|
61
63
|
try {
|
|
62
|
-
await ensureProjectEnvironment(projectRoot);
|
|
64
|
+
await ensureProjectEnvironment(projectRoot, { skipDatabase: true });
|
|
63
65
|
}
|
|
64
66
|
catch (err) {
|
|
65
67
|
console.error(t('dev.envFailed'), err.message || err);
|
|
66
68
|
process.exit(1);
|
|
67
69
|
}
|
|
70
|
+
await applyAutoLocalDevFallback(projectRoot, { needsLocalApi: true });
|
|
68
71
|
try {
|
|
69
72
|
await ensureDevDatabase(projectRoot);
|
|
70
73
|
}
|
|
@@ -88,6 +91,13 @@ async function runApiDev(projectRoot = ensureOriginalCwd()) {
|
|
|
88
91
|
return;
|
|
89
92
|
}
|
|
90
93
|
}
|
|
94
|
+
if (!isUsingMonorepoServer(projectRoot)) {
|
|
95
|
+
const bundled = await ensureBundledServerDeps(projectRoot);
|
|
96
|
+
if (!bundled.ok) {
|
|
97
|
+
console.error(bundled.message || t('bundle.serverBundle.notBuilt'));
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
91
101
|
startApiDev(projectRoot);
|
|
92
102
|
}
|
|
93
103
|
function getApiDevScriptPath() {
|
package/out/lib/bootstrap.js
CHANGED
|
@@ -13,20 +13,21 @@ const cli_context_1 = require("../core/utils/cli-context");
|
|
|
13
13
|
const config_1 = require("../core/services/config");
|
|
14
14
|
const database_1 = require("../core/services/database");
|
|
15
15
|
const init_1 = require("../core/services/init");
|
|
16
|
-
const paths_1 = require("../core/utils/paths");
|
|
17
16
|
const root_1 = require("./root");
|
|
18
17
|
Object.defineProperty(exports, "isMonorepoCheckout", { enumerable: true, get: function () { return root_1.isMonorepoCheckout; } });
|
|
19
18
|
const i18n_1 = require("./i18n");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return (0, init_1.initProject)({ directory: projectRoot, force, local: true });
|
|
19
|
+
function applyZeroDependencyDefaults() {
|
|
20
|
+
if (!process.env.REACTPRESS_LOCAL_MODE) {
|
|
21
|
+
process.env.REACTPRESS_LOCAL_MODE = '1';
|
|
22
|
+
}
|
|
23
|
+
if (!process.env.REACTPRESS_SKIP_NGINX) {
|
|
24
|
+
process.env.REACTPRESS_SKIP_NGINX = '1';
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
}
|
|
27
|
+
async function initMonorepoProject(projectRoot, { force = false } = {}) {
|
|
28
|
+
applyZeroDependencyDefaults();
|
|
29
|
+
const { getProjectPaths } = require('../core/utils/paths');
|
|
30
|
+
const paths = getProjectPaths(projectRoot);
|
|
30
31
|
if (node_fs_1.default.existsSync(paths.configPath) && !force) {
|
|
31
32
|
const config = await (0, config_1.loadConfig)(projectRoot);
|
|
32
33
|
await (0, database_1.ensureDatabaseHostPort)(projectRoot, undefined, config);
|
|
@@ -36,41 +37,13 @@ async function initMonorepoProject(projectRoot, { force = false, local = false }
|
|
|
36
37
|
}
|
|
37
38
|
return { ok: true, projectRoot, message: (0, i18n_1.t)('bootstrap.configReady') };
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
await copyTemplateFile(node_path_1.default.join(templatesDir, 'docker-compose.yml'), paths.dockerComposePath);
|
|
41
|
-
const config = JSON.parse(await node_fs_1.default.promises.readFile(node_path_1.default.join(templatesDir, 'config.default.json'), 'utf8'));
|
|
42
|
-
await (0, config_1.saveConfig)(projectRoot, config);
|
|
43
|
-
await (0, config_1.syncEnvFromConfig)(projectRoot, config);
|
|
44
|
-
if (!node_fs_1.default.existsSync(paths.envPath) || force) {
|
|
45
|
-
await copyTemplateFile(node_path_1.default.join(templatesDir, 'env.default'), paths.envPath);
|
|
46
|
-
await (0, config_1.syncEnvFromConfig)(projectRoot, config);
|
|
47
|
-
}
|
|
48
|
-
await (0, database_1.ensureDatabaseHostPort)(projectRoot, undefined, config);
|
|
49
|
-
const dbResult = await (0, database_1.ensureDatabase)(projectRoot, config);
|
|
50
|
-
if (!dbResult.ok) {
|
|
51
|
-
return {
|
|
52
|
-
ok: true,
|
|
53
|
-
projectRoot,
|
|
54
|
-
message: (0, i18n_1.t)('bootstrap.projectDbPending', { message: dbResult.message ?? '' }),
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
ok: true,
|
|
59
|
-
projectRoot,
|
|
60
|
-
message: (0, i18n_1.t)('bootstrap.ready'),
|
|
61
|
-
};
|
|
40
|
+
return (0, init_1.initProject)({ directory: projectRoot, force });
|
|
62
41
|
}
|
|
63
42
|
async function ensureProjectEnvironment(projectRoot = (0, root_1.ensureOriginalCwd)(), options = {}) {
|
|
43
|
+
applyZeroDependencyDefaults();
|
|
64
44
|
const root = node_path_1.default.resolve(projectRoot);
|
|
65
45
|
(0, cli_context_1.setProjectCwd)(root);
|
|
66
46
|
if (!(await (0, config_1.isReactPressProject)(root))) {
|
|
67
|
-
if ((0, root_1.isMonorepoCheckout)(root)) {
|
|
68
|
-
const result = await initMonorepoProject(root);
|
|
69
|
-
if (!result.ok) {
|
|
70
|
-
throw new Error(result.message || (0, i18n_1.t)('bootstrap.initFailed'));
|
|
71
|
-
}
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
47
|
const result = await (0, init_1.initProject)({ directory: root, force: false });
|
|
75
48
|
if (!result.ok) {
|
|
76
49
|
throw new Error(result.message || (0, i18n_1.t)('bootstrap.cliInitFailed'));
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cliEvents = void 0;
|
|
4
|
+
exports.isInkDashboard = isInkDashboard;
|
|
5
|
+
exports.enableInkDashboard = enableInkDashboard;
|
|
6
|
+
exports.disableInkDashboard = disableInkDashboard;
|
|
7
|
+
exports.emitDevPhase = emitDevPhase;
|
|
8
|
+
exports.emitDevStatus = emitDevStatus;
|
|
9
|
+
exports.emitDevStatusRaw = emitDevStatusRaw;
|
|
10
|
+
exports.emitDevService = emitDevService;
|
|
11
|
+
exports.emitDevReady = emitDevReady;
|
|
12
|
+
exports.emitDevError = emitDevError;
|
|
13
|
+
const events_1 = require("events");
|
|
14
|
+
exports.cliEvents = new events_1.EventEmitter();
|
|
15
|
+
function isInkDashboard() {
|
|
16
|
+
return process.env.REACTPRESS_INK_DASHBOARD === '1';
|
|
17
|
+
}
|
|
18
|
+
function enableInkDashboard() {
|
|
19
|
+
process.env.REACTPRESS_INK_DASHBOARD = '1';
|
|
20
|
+
}
|
|
21
|
+
function disableInkDashboard() {
|
|
22
|
+
delete process.env.REACTPRESS_INK_DASHBOARD;
|
|
23
|
+
}
|
|
24
|
+
function emitDevPhase(step, total, key, vars = {}) {
|
|
25
|
+
if (!isInkDashboard())
|
|
26
|
+
return;
|
|
27
|
+
exports.cliEvents.emit('dev:phase', { step, total, key, vars });
|
|
28
|
+
}
|
|
29
|
+
function emitDevStatus(key, vars = {}) {
|
|
30
|
+
if (!isInkDashboard())
|
|
31
|
+
return;
|
|
32
|
+
exports.cliEvents.emit('dev:status', { key, vars });
|
|
33
|
+
}
|
|
34
|
+
function emitDevStatusRaw(text) {
|
|
35
|
+
if (!isInkDashboard())
|
|
36
|
+
return;
|
|
37
|
+
exports.cliEvents.emit('dev:status-raw', { text });
|
|
38
|
+
}
|
|
39
|
+
function emitDevService(name, state, extra = {}) {
|
|
40
|
+
if (!isInkDashboard())
|
|
41
|
+
return;
|
|
42
|
+
exports.cliEvents.emit('dev:service', { name, state, ...extra });
|
|
43
|
+
}
|
|
44
|
+
function emitDevReady(payload) {
|
|
45
|
+
if (!isInkDashboard())
|
|
46
|
+
return;
|
|
47
|
+
exports.cliEvents.emit('dev:ready', payload);
|
|
48
|
+
}
|
|
49
|
+
function emitDevError(message) {
|
|
50
|
+
if (!isInkDashboard())
|
|
51
|
+
return;
|
|
52
|
+
exports.cliEvents.emit('dev:error', { message });
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=cli-events.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.QUICK_PICK_VALUES = void 0;
|
|
5
|
+
exports.filterCommandItems = filterCommandItems;
|
|
6
|
+
exports.buildPaletteRows = buildPaletteRows;
|
|
7
|
+
exports.getQuickPickEntries = getQuickPickEntries;
|
|
8
|
+
exports.getPaletteFocusTarget = getPaletteFocusTarget;
|
|
9
|
+
exports.QUICK_PICK_VALUES = ['dev', 'init', 'status', 'build'];
|
|
10
|
+
function filterCommandItems(items, query) {
|
|
11
|
+
const raw = String(query || '').replace(/^\//, '').trim().toLowerCase();
|
|
12
|
+
const entries = items.filter((e) => e.type === 'item');
|
|
13
|
+
if (!raw)
|
|
14
|
+
return entries;
|
|
15
|
+
return entries.filter((entry) => {
|
|
16
|
+
const haystack = [
|
|
17
|
+
entry.value,
|
|
18
|
+
entry.label,
|
|
19
|
+
entry.hint,
|
|
20
|
+
...(entry.slash || []),
|
|
21
|
+
]
|
|
22
|
+
.join(' ')
|
|
23
|
+
.toLowerCase();
|
|
24
|
+
return raw.split(/\s+/).every((token) => haystack.includes(token));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function buildPaletteRows(items, filtered) {
|
|
28
|
+
const rows = [];
|
|
29
|
+
let sectionTitle = '';
|
|
30
|
+
for (const entry of items) {
|
|
31
|
+
if (entry.type === 'section') {
|
|
32
|
+
sectionTitle = entry.title || '';
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (!filtered.some((f) => f.value === entry.value))
|
|
36
|
+
continue;
|
|
37
|
+
rows.push({ ...entry, sectionTitle });
|
|
38
|
+
}
|
|
39
|
+
return rows;
|
|
40
|
+
}
|
|
41
|
+
function getQuickPickEntries(items, values = exports.QUICK_PICK_VALUES) {
|
|
42
|
+
const map = new Map(items.filter((e) => e.type === 'item').map((e) => [e.value, e]));
|
|
43
|
+
return values.map((v) => map.get(v)).filter(Boolean);
|
|
44
|
+
}
|
|
45
|
+
function getPaletteFocusTarget(paletteOpen, query, items, focusIndex, quickPicks) {
|
|
46
|
+
if (!paletteOpen) {
|
|
47
|
+
return quickPicks[focusIndex] || null;
|
|
48
|
+
}
|
|
49
|
+
const filtered = filterCommandItems(items, query);
|
|
50
|
+
const rows = buildPaletteRows(items, filtered).slice(0, 12);
|
|
51
|
+
return rows[Math.min(focusIndex, Math.max(0, rows.length - 1))] || null;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=command-palette.js.map
|