@kamod-ch/preactpress 1.0.0
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/LICENSE +21 -0
- package/README.md +165 -0
- package/assets/favicon-32.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/favicon.svg +28 -0
- package/assets/logo-dark.svg +5 -0
- package/assets/logo-light.svg +5 -0
- package/assets/logo.svg +5 -0
- package/bin/preactpress.mjs +13 -0
- package/dist/client/app.d.ts +6 -0
- package/dist/client/app.d.ts.map +1 -0
- package/dist/client/app.js +168 -0
- package/dist/client/app.js.map +1 -0
- package/dist/client/entry-client.d.ts +2 -0
- package/dist/client/entry-client.d.ts.map +1 -0
- package/dist/client/entry-client.js +27 -0
- package/dist/client/entry-client.js.map +1 -0
- package/dist/client/entry-ssr.d.ts +14 -0
- package/dist/client/entry-ssr.d.ts.map +1 -0
- package/dist/client/entry-ssr.js +59 -0
- package/dist/client/entry-ssr.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/loadPage.d.ts +5 -0
- package/dist/client/loadPage.d.ts.map +1 -0
- package/dist/client/loadPage.js +62 -0
- package/dist/client/loadPage.js.map +1 -0
- package/dist/client/prefetchLinks.d.ts +2 -0
- package/dist/client/prefetchLinks.d.ts.map +1 -0
- package/dist/client/prefetchLinks.js +55 -0
- package/dist/client/prefetchLinks.js.map +1 -0
- package/dist/client/theme-default/AlgoliaSearch.d.ts +12 -0
- package/dist/client/theme-default/AlgoliaSearch.d.ts.map +1 -0
- package/dist/client/theme-default/AlgoliaSearch.js +66 -0
- package/dist/client/theme-default/AlgoliaSearch.js.map +1 -0
- package/dist/client/theme-default/Features.d.ts +9 -0
- package/dist/client/theme-default/Features.d.ts.map +1 -0
- package/dist/client/theme-default/Features.js +25 -0
- package/dist/client/theme-default/Features.js.map +1 -0
- package/dist/client/theme-default/Hero.d.ts +9 -0
- package/dist/client/theme-default/Hero.d.ts.map +1 -0
- package/dist/client/theme-default/Hero.js +23 -0
- package/dist/client/theme-default/Hero.js.map +1 -0
- package/dist/client/theme-default/Layout.d.ts +6 -0
- package/dist/client/theme-default/Layout.d.ts.map +1 -0
- package/dist/client/theme-default/Layout.js +224 -0
- package/dist/client/theme-default/Layout.js.map +1 -0
- package/dist/client/theme-default/Logo.d.ts +16 -0
- package/dist/client/theme-default/Logo.d.ts.map +1 -0
- package/dist/client/theme-default/Logo.js +30 -0
- package/dist/client/theme-default/Logo.js.map +1 -0
- package/dist/client/theme-default/NavLinks.d.ts +12 -0
- package/dist/client/theme-default/NavLinks.d.ts.map +1 -0
- package/dist/client/theme-default/NavLinks.js +18 -0
- package/dist/client/theme-default/NavLinks.js.map +1 -0
- package/dist/client/theme-default/SidebarNav.d.ts +12 -0
- package/dist/client/theme-default/SidebarNav.d.ts.map +1 -0
- package/dist/client/theme-default/SidebarNav.js +21 -0
- package/dist/client/theme-default/SidebarNav.js.map +1 -0
- package/dist/client/theme-default/SocialLinks.d.ts +8 -0
- package/dist/client/theme-default/SocialLinks.d.ts.map +1 -0
- package/dist/client/theme-default/SocialLinks.js +13 -0
- package/dist/client/theme-default/SocialLinks.js.map +1 -0
- package/dist/client/theme-default/ThemeToggle.d.ts +4 -0
- package/dist/client/theme-default/ThemeToggle.d.ts.map +1 -0
- package/dist/client/theme-default/ThemeToggle.js +31 -0
- package/dist/client/theme-default/ThemeToggle.js.map +1 -0
- package/dist/client/theme-default/index.d.ts +2 -0
- package/dist/client/theme-default/index.d.ts.map +1 -0
- package/dist/client/theme-default/index.js +2 -0
- package/dist/client/theme-default/index.js.map +1 -0
- package/dist/client/types.d.ts +36 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/client/usePageHead.d.ts +10 -0
- package/dist/client/usePageHead.d.ts.map +1 -0
- package/dist/client/usePageHead.js +182 -0
- package/dist/client/usePageHead.js.map +1 -0
- package/dist/client/useSiteSearch.d.ts +10 -0
- package/dist/client/useSiteSearch.d.ts.map +1 -0
- package/dist/client/useSiteSearch.js +54 -0
- package/dist/client/useSiteSearch.js.map +1 -0
- package/dist/node/build.d.ts +15 -0
- package/dist/node/build.d.ts.map +1 -0
- package/dist/node/build.js +310 -0
- package/dist/node/build.js.map +1 -0
- package/dist/node/buildCache.d.ts +15 -0
- package/dist/node/buildCache.d.ts.map +1 -0
- package/dist/node/buildCache.js +41 -0
- package/dist/node/buildCache.js.map +1 -0
- package/dist/node/check.d.ts +11 -0
- package/dist/node/check.d.ts.map +1 -0
- package/dist/node/check.js +228 -0
- package/dist/node/check.js.map +1 -0
- package/dist/node/cli.d.ts +2 -0
- package/dist/node/cli.d.ts.map +1 -0
- package/dist/node/cli.js +157 -0
- package/dist/node/cli.js.map +1 -0
- package/dist/node/config-helpers.d.ts +8 -0
- package/dist/node/config-helpers.d.ts.map +1 -0
- package/dist/node/config-helpers.js +5 -0
- package/dist/node/config-helpers.js.map +1 -0
- package/dist/node/config.d.ts +13 -0
- package/dist/node/config.d.ts.map +1 -0
- package/dist/node/config.js +167 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/content.d.ts +16 -0
- package/dist/node/content.d.ts.map +1 -0
- package/dist/node/content.js +72 -0
- package/dist/node/content.js.map +1 -0
- package/dist/node/createContentLoader.d.ts +19 -0
- package/dist/node/createContentLoader.d.ts.map +1 -0
- package/dist/node/createContentLoader.js +11 -0
- package/dist/node/createContentLoader.js.map +1 -0
- package/dist/node/devCss.d.ts +7 -0
- package/dist/node/devCss.d.ts.map +1 -0
- package/dist/node/devCss.js +70 -0
- package/dist/node/devCss.js.map +1 -0
- package/dist/node/devSsr.d.ts +6 -0
- package/dist/node/devSsr.d.ts.map +1 -0
- package/dist/node/devSsr.js +112 -0
- package/dist/node/devSsr.js.map +1 -0
- package/dist/node/dynamicRoutes.d.ts +21 -0
- package/dist/node/dynamicRoutes.d.ts.map +1 -0
- package/dist/node/dynamicRoutes.js +120 -0
- package/dist/node/dynamicRoutes.js.map +1 -0
- package/dist/node/favicon.d.ts +9 -0
- package/dist/node/favicon.d.ts.map +1 -0
- package/dist/node/favicon.js +71 -0
- package/dist/node/favicon.js.map +1 -0
- package/dist/node/feed.d.ts +7 -0
- package/dist/node/feed.d.ts.map +1 -0
- package/dist/node/feed.js +37 -0
- package/dist/node/feed.js.map +1 -0
- package/dist/node/hooks.d.ts +9 -0
- package/dist/node/hooks.d.ts.map +1 -0
- package/dist/node/hooks.js +20 -0
- package/dist/node/hooks.js.map +1 -0
- package/dist/node/html.d.ts +56 -0
- package/dist/node/html.d.ts.map +1 -0
- package/dist/node/html.js +222 -0
- package/dist/node/html.js.map +1 -0
- package/dist/node/index.d.ts +12 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +9 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/init.d.ts +12 -0
- package/dist/node/init.d.ts.map +1 -0
- package/dist/node/init.js +93 -0
- package/dist/node/init.js.map +1 -0
- package/dist/node/lastUpdated.d.ts +3 -0
- package/dist/node/lastUpdated.d.ts.map +1 -0
- package/dist/node/lastUpdated.js +24 -0
- package/dist/node/lastUpdated.js.map +1 -0
- package/dist/node/loadSiteModule.d.ts +2 -0
- package/dist/node/loadSiteModule.d.ts.map +1 -0
- package/dist/node/loadSiteModule.js +10 -0
- package/dist/node/loadSiteModule.js.map +1 -0
- package/dist/node/markdown.d.ts +31 -0
- package/dist/node/markdown.d.ts.map +1 -0
- package/dist/node/markdown.js +508 -0
- package/dist/node/markdown.js.map +1 -0
- package/dist/node/markdownHeadings.d.ts +12 -0
- package/dist/node/markdownHeadings.d.ts.map +1 -0
- package/dist/node/markdownHeadings.js +70 -0
- package/dist/node/markdownHeadings.js.map +1 -0
- package/dist/node/markdownInclude.d.ts +6 -0
- package/dist/node/markdownInclude.d.ts.map +1 -0
- package/dist/node/markdownInclude.js +74 -0
- package/dist/node/markdownInclude.js.map +1 -0
- package/dist/node/markdownSnippets.d.ts +32 -0
- package/dist/node/markdownSnippets.d.ts.map +1 -0
- package/dist/node/markdownSnippets.js +172 -0
- package/dist/node/markdownSnippets.js.map +1 -0
- package/dist/node/mdx.d.ts +3 -0
- package/dist/node/mdx.d.ts.map +1 -0
- package/dist/node/mdx.js +9 -0
- package/dist/node/mdx.js.map +1 -0
- package/dist/node/packageRoot.d.ts +4 -0
- package/dist/node/packageRoot.d.ts.map +1 -0
- package/dist/node/packageRoot.js +7 -0
- package/dist/node/packageRoot.js.map +1 -0
- package/dist/node/pageDataLoaders.d.ts +6 -0
- package/dist/node/pageDataLoaders.d.ts.map +1 -0
- package/dist/node/pageDataLoaders.js +68 -0
- package/dist/node/pageDataLoaders.js.map +1 -0
- package/dist/node/paths.d.ts +5 -0
- package/dist/node/paths.d.ts.map +1 -0
- package/dist/node/paths.js +12 -0
- package/dist/node/paths.js.map +1 -0
- package/dist/node/plugin.d.ts +7 -0
- package/dist/node/plugin.d.ts.map +1 -0
- package/dist/node/plugin.js +282 -0
- package/dist/node/plugin.js.map +1 -0
- package/dist/node/resolveDeps.d.ts +5 -0
- package/dist/node/resolveDeps.d.ts.map +1 -0
- package/dist/node/resolveDeps.js +25 -0
- package/dist/node/resolveDeps.js.map +1 -0
- package/dist/node/serve.d.ts +6 -0
- package/dist/node/serve.d.ts.map +1 -0
- package/dist/node/serve.js +41 -0
- package/dist/node/serve.js.map +1 -0
- package/dist/node/server.d.ts +7 -0
- package/dist/node/server.d.ts.map +1 -0
- package/dist/node/server.js +55 -0
- package/dist/node/server.js.map +1 -0
- package/dist/node/siteConfig.d.ts +206 -0
- package/dist/node/siteConfig.d.ts.map +1 -0
- package/dist/node/siteConfig.js +2 -0
- package/dist/node/siteConfig.js.map +1 -0
- package/dist/node/tagIndex.d.ts +27 -0
- package/dist/node/tagIndex.d.ts.map +1 -0
- package/dist/node/tagIndex.js +84 -0
- package/dist/node/tagIndex.js.map +1 -0
- package/dist/shared/contentChunk.d.ts +4 -0
- package/dist/shared/contentChunk.d.ts.map +1 -0
- package/dist/shared/contentChunk.js +14 -0
- package/dist/shared/contentChunk.js.map +1 -0
- package/dist/shared/contentSchema.d.ts +43 -0
- package/dist/shared/contentSchema.d.ts.map +1 -0
- package/dist/shared/contentSchema.js +44 -0
- package/dist/shared/contentSchema.js.map +1 -0
- package/dist/shared/deadLinks.d.ts +9 -0
- package/dist/shared/deadLinks.d.ts.map +1 -0
- package/dist/shared/deadLinks.js +27 -0
- package/dist/shared/deadLinks.js.map +1 -0
- package/dist/shared/escapeHtml.d.ts +3 -0
- package/dist/shared/escapeHtml.d.ts.map +1 -0
- package/dist/shared/escapeHtml.js +11 -0
- package/dist/shared/escapeHtml.js.map +1 -0
- package/dist/shared/index.d.ts +15 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +15 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/locale.d.ts +11 -0
- package/dist/shared/locale.d.ts.map +1 -0
- package/dist/shared/locale.js +84 -0
- package/dist/shared/locale.js.map +1 -0
- package/dist/shared/pageChrome.d.ts +80 -0
- package/dist/shared/pageChrome.d.ts.map +1 -0
- package/dist/shared/pageChrome.js +160 -0
- package/dist/shared/pageChrome.js.map +1 -0
- package/dist/shared/pageHead.d.ts +3 -0
- package/dist/shared/pageHead.d.ts.map +1 -0
- package/dist/shared/pageHead.js +28 -0
- package/dist/shared/pageHead.js.map +1 -0
- package/dist/shared/pageMeta.d.ts +60 -0
- package/dist/shared/pageMeta.d.ts.map +1 -0
- package/dist/shared/pageMeta.js +72 -0
- package/dist/shared/pageMeta.js.map +1 -0
- package/dist/shared/rewrites.d.ts +5 -0
- package/dist/shared/rewrites.d.ts.map +1 -0
- package/dist/shared/rewrites.js +23 -0
- package/dist/shared/rewrites.js.map +1 -0
- package/dist/shared/route.d.ts +5 -0
- package/dist/shared/route.d.ts.map +1 -0
- package/dist/shared/route.js +15 -0
- package/dist/shared/route.js.map +1 -0
- package/dist/shared/search.d.ts +39 -0
- package/dist/shared/search.d.ts.map +1 -0
- package/dist/shared/search.js +63 -0
- package/dist/shared/search.js.map +1 -0
- package/dist/shared/sidebar.d.ts +18 -0
- package/dist/shared/sidebar.d.ts.map +1 -0
- package/dist/shared/sidebar.js +51 -0
- package/dist/shared/sidebar.js.map +1 -0
- package/dist/shared/slug.d.ts +4 -0
- package/dist/shared/slug.d.ts.map +1 -0
- package/dist/shared/slug.js +21 -0
- package/dist/shared/slug.js.map +1 -0
- package/dist/shared/socialIcons.d.ts +13 -0
- package/dist/shared/socialIcons.d.ts.map +1 -0
- package/dist/shared/socialIcons.js +27 -0
- package/dist/shared/socialIcons.js.map +1 -0
- package/dist/shared/tags.d.ts +6 -0
- package/dist/shared/tags.d.ts.map +1 -0
- package/dist/shared/tags.js +39 -0
- package/dist/shared/tags.js.map +1 -0
- package/dist/shared/theme.d.ts +8 -0
- package/dist/shared/theme.d.ts.map +1 -0
- package/dist/shared/theme.js +25 -0
- package/dist/shared/theme.js.map +1 -0
- package/dist/shared/themeLabels.d.ts +18 -0
- package/dist/shared/themeLabels.d.ts.map +1 -0
- package/dist/shared/themeLabels.js +51 -0
- package/dist/shared/themeLabels.js.map +1 -0
- package/dist/shared/url.d.ts +7 -0
- package/dist/shared/url.d.ts.map +1 -0
- package/dist/shared/url.js +10 -0
- package/dist/shared/url.js.map +1 -0
- package/package.json +108 -0
- package/src/client/app.tsx +194 -0
- package/src/client/entry-client.tsx +27 -0
- package/src/client/entry-ssr.tsx +77 -0
- package/src/client/index.ts +2 -0
- package/src/client/loadPage.ts +68 -0
- package/src/client/prefetchLinks.ts +60 -0
- package/src/client/theme-default/AlgoliaSearch.tsx +89 -0
- package/src/client/theme-default/Features.tsx +75 -0
- package/src/client/theme-default/Hero.tsx +60 -0
- package/src/client/theme-default/Layout.tsx +525 -0
- package/src/client/theme-default/Logo.tsx +104 -0
- package/src/client/theme-default/NavLinks.tsx +65 -0
- package/src/client/theme-default/SidebarNav.tsx +103 -0
- package/src/client/theme-default/SocialLinks.tsx +41 -0
- package/src/client/theme-default/ThemeToggle.tsx +79 -0
- package/src/client/theme-default/index.ts +1 -0
- package/src/client/theme-default/styles.css +1450 -0
- package/src/client/types.ts +37 -0
- package/src/client/usePageHead.ts +212 -0
- package/src/client/useSiteSearch.ts +57 -0
- package/src/client/virtual.d.ts +103 -0
- package/src/shared/contentChunk.ts +14 -0
- package/src/shared/contentSchema.ts +85 -0
- package/src/shared/deadLinks.ts +33 -0
- package/src/shared/escapeHtml.ts +11 -0
- package/src/shared/index.ts +83 -0
- package/src/shared/locale.ts +116 -0
- package/src/shared/pageChrome.ts +244 -0
- package/src/shared/pageHead.ts +26 -0
- package/src/shared/pageMeta.ts +136 -0
- package/src/shared/rewrites.ts +35 -0
- package/src/shared/route.ts +14 -0
- package/src/shared/search.ts +105 -0
- package/src/shared/sidebar.ts +67 -0
- package/src/shared/slug.ts +23 -0
- package/src/shared/socialIcons.ts +44 -0
- package/src/shared/tags.ts +36 -0
- package/src/shared/theme.ts +26 -0
- package/src/shared/themeLabels.ts +72 -0
- package/src/shared/url.ts +14 -0
- package/templates/default/.preactpress/config.ts +31 -0
- package/templates/default/README.md +45 -0
- package/templates/default/about.md +11 -0
- package/templates/default/guide/first-five-minutes.md +83 -0
- package/templates/default/index.html +18 -0
- package/templates/default/index.md +55 -0
- package/templates/default/package.json +15 -0
- package/templates/default/pnpm-lock.yaml +2917 -0
- package/templates/docs/.preactpress/config.ts +94 -0
- package/templates/docs/README.md +21 -0
- package/templates/docs/about.md +10 -0
- package/templates/docs/components/Counter.tsx +25 -0
- package/templates/docs/de/guide/getting-started.md +19 -0
- package/templates/docs/de/guide/what-is-preactpress.md +15 -0
- package/templates/docs/de/index.md +23 -0
- package/templates/docs/dist/404.html +29 -0
- package/templates/docs/dist/about/index.html +32 -0
- package/templates/docs/dist/assets/esm-DzlBxN5p.js +110 -0
- package/templates/docs/dist/assets/interactive-64o6YwrR.js +9 -0
- package/templates/docs/dist/assets/interactive-BedCloEw.js +9 -0
- package/templates/docs/dist/assets/main-BVLeh8GO.js +1 -0
- package/templates/docs/dist/assets/main-CreUBb3N.js +1 -0
- package/templates/docs/dist/assets/main-oodK-zZy.css +2 -0
- package/templates/docs/dist/de/guide/getting-started/index.html +36 -0
- package/templates/docs/dist/de/guide/what-is-preactpress/index.html +38 -0
- package/templates/docs/dist/de/index.html +29 -0
- package/templates/docs/dist/favicon-32.png +0 -0
- package/templates/docs/dist/favicon.png +0 -0
- package/templates/docs/dist/favicon.svg +28 -0
- package/templates/docs/dist/guide/advanced/index.html +53 -0
- package/templates/docs/dist/guide/commands/index.html +89 -0
- package/templates/docs/dist/guide/configuration/index.html +196 -0
- package/templates/docs/dist/guide/creating-pages/index.html +234 -0
- package/templates/docs/dist/guide/custom-themes/index.html +52 -0
- package/templates/docs/dist/guide/default-theme/index.html +53 -0
- package/templates/docs/dist/guide/deploy/index.html +195 -0
- package/templates/docs/dist/guide/first-five-minutes/index.html +99 -0
- package/templates/docs/dist/guide/getting-started/index.html +173 -0
- package/templates/docs/dist/guide/markdown-and-mdx/index.html +59 -0
- package/templates/docs/dist/guide/routing/index.html +192 -0
- package/templates/docs/dist/guide/what-is-preactpress/index.html +141 -0
- package/templates/docs/dist/index.html +30 -0
- package/templates/docs/dist/interactive/index.html +37 -0
- package/templates/docs/dist/markdown-examples/index.html +231 -0
- package/templates/docs/dist/preactpress-content/404.json +8 -0
- package/templates/docs/dist/preactpress-content/_index.json +50 -0
- package/templates/docs/dist/preactpress-content/about.json +15 -0
- package/templates/docs/dist/preactpress-content/de.json +45 -0
- package/templates/docs/dist/preactpress-content/de__guide__getting-started.json +26 -0
- package/templates/docs/dist/preactpress-content/de__guide__what-is-preactpress.json +21 -0
- package/templates/docs/dist/preactpress-content/guide__advanced.json +46 -0
- package/templates/docs/dist/preactpress-content/guide__commands.json +26 -0
- package/templates/docs/dist/preactpress-content/guide__configuration.json +51 -0
- package/templates/docs/dist/preactpress-content/guide__creating-pages.json +71 -0
- package/templates/docs/dist/preactpress-content/guide__custom-themes.json +15 -0
- package/templates/docs/dist/preactpress-content/guide__default-theme.json +36 -0
- package/templates/docs/dist/preactpress-content/guide__deploy.json +56 -0
- package/templates/docs/dist/preactpress-content/guide__first-five-minutes.json +36 -0
- package/templates/docs/dist/preactpress-content/guide__getting-started.json +51 -0
- package/templates/docs/dist/preactpress-content/guide__markdown-and-mdx.json +31 -0
- package/templates/docs/dist/preactpress-content/guide__routing.json +71 -0
- package/templates/docs/dist/preactpress-content/guide__what-is-preactpress.json +51 -0
- package/templates/docs/dist/preactpress-content/markdown-examples.json +71 -0
- package/templates/docs/dist/preactpress-content/tags__markdown.json +16 -0
- package/templates/docs/dist/preactpress-search.json +166 -0
- package/templates/docs/dist/preactpress-theme.js +1 -0
- package/templates/docs/dist/tags/markdown/index.html +32 -0
- package/templates/docs/guide/advanced.md +44 -0
- package/templates/docs/guide/commands.md +41 -0
- package/templates/docs/guide/configuration.md +130 -0
- package/templates/docs/guide/creating-pages.md +171 -0
- package/templates/docs/guide/custom-themes.md +39 -0
- package/templates/docs/guide/default-theme.md +41 -0
- package/templates/docs/guide/deploy.md +197 -0
- package/templates/docs/guide/first-five-minutes.md +82 -0
- package/templates/docs/guide/getting-started.md +146 -0
- package/templates/docs/guide/markdown-and-mdx.md +59 -0
- package/templates/docs/guide/routing.md +263 -0
- package/templates/docs/guide/what-is-preactpress.md +87 -0
- package/templates/docs/index.html +18 -0
- package/templates/docs/index.md +28 -0
- package/templates/docs/interactive.mdx +32 -0
- package/templates/docs/markdown-examples.md +72 -0
- package/templates/docs/package.json +15 -0
- package/templates/docs/partials/shared-note.md +3 -0
- package/templates/docs/parts/include-body.md +9 -0
- package/templates/docs/pnpm-lock.yaml +2917 -0
- package/templates/docs/snippets/greet.ts +3 -0
- package/templates/hono/.preactpress/config.ts +100 -0
- package/templates/hono/.preactpress/theme/CodeSnippet.tsx +41 -0
- package/templates/hono/.preactpress/theme/FeatureGrid.tsx +27 -0
- package/templates/hono/.preactpress/theme/Hero.tsx +45 -0
- package/templates/hono/.preactpress/theme/Layout.tsx +388 -0
- package/templates/hono/.preactpress/theme/Logo.tsx +26 -0
- package/templates/hono/.preactpress/theme/ThemeToggle.tsx +72 -0
- package/templates/hono/.preactpress/theme/hono.css +1058 -0
- package/templates/hono/README.md +41 -0
- package/templates/hono/about.md +10 -0
- package/templates/hono/components/Counter.tsx +25 -0
- package/templates/hono/de/about.md +10 -0
- package/templates/hono/de/guide/commands.md +44 -0
- package/templates/hono/de/guide/configuration.md +64 -0
- package/templates/hono/de/guide/deploy.md +197 -0
- package/templates/hono/de/guide/first-five-minutes.md +82 -0
- package/templates/hono/de/guide/getting-started.md +146 -0
- package/templates/hono/de/guide/routing.md +220 -0
- package/templates/hono/de/guide/seiten-erstellen.md +171 -0
- package/templates/hono/de/guide/what-is-preactpress.md +87 -0
- package/templates/hono/de/index.mdx +51 -0
- package/templates/hono/de/interactive.mdx +32 -0
- package/templates/hono/de/markdown-examples.md +142 -0
- package/templates/hono/de/parts/include-body.md +9 -0
- package/templates/hono/de/snippets/greet.ts +3 -0
- package/templates/hono/dist/404.html +29 -0
- package/templates/hono/dist/README/index.html +104 -0
- package/templates/hono/dist/about/index.html +32 -0
- package/templates/hono/dist/assets/Counter-CCEByS-J.js +1 -0
- package/templates/hono/dist/assets/Hero--o6WMNvm.js +2 -0
- package/templates/hono/dist/assets/de-D5r6Ye70.js +10 -0
- package/templates/hono/dist/assets/hono-BXWYYdyv.js +10 -0
- package/templates/hono/dist/assets/interactive-Bxo-WBpC.js +9 -0
- package/templates/hono/dist/assets/interactive-BznI4IQ3.js +9 -0
- package/templates/hono/dist/assets/main-Bqi-VFEk.js +2 -0
- package/templates/hono/dist/assets/main-DIIN7FO0.css +1 -0
- package/templates/hono/dist/de/about/index.html +32 -0
- package/templates/hono/dist/de/guide/commands/index.html +41 -0
- package/templates/hono/dist/de/guide/configuration/index.html +105 -0
- package/templates/hono/dist/de/guide/deploy/index.html +195 -0
- package/templates/hono/dist/de/guide/first-five-minutes/index.html +99 -0
- package/templates/hono/dist/de/guide/getting-started/index.html +173 -0
- package/templates/hono/dist/de/guide/routing/index.html +165 -0
- package/templates/hono/dist/de/guide/seiten-erstellen/index.html +234 -0
- package/templates/hono/dist/de/guide/what-is-preactpress/index.html +141 -0
- package/templates/hono/dist/de/index.html +30 -0
- package/templates/hono/dist/de/interactive/index.html +37 -0
- package/templates/hono/dist/de/markdown-examples/index.html +97 -0
- package/templates/hono/dist/de/parts/include-body/index.html +36 -0
- package/templates/hono/dist/de/tags/markdown/index.html +32 -0
- package/templates/hono/dist/favicon-32.png +0 -0
- package/templates/hono/dist/favicon.png +0 -0
- package/templates/hono/dist/favicon.svg +28 -0
- package/templates/hono/dist/guide/commands/index.html +41 -0
- package/templates/hono/dist/guide/configuration/index.html +158 -0
- package/templates/hono/dist/guide/creating-pages/index.html +234 -0
- package/templates/hono/dist/guide/deploy/index.html +195 -0
- package/templates/hono/dist/guide/first-five-minutes/index.html +99 -0
- package/templates/hono/dist/guide/getting-started/index.html +173 -0
- package/templates/hono/dist/guide/routing/index.html +165 -0
- package/templates/hono/dist/guide/what-is-preactpress/index.html +141 -0
- package/templates/hono/dist/index.html +30 -0
- package/templates/hono/dist/interactive/index.html +37 -0
- package/templates/hono/dist/markdown-examples/index.html +105 -0
- package/templates/hono/dist/partials/shared-note/index.html +30 -0
- package/templates/hono/dist/parts/include-body/index.html +36 -0
- package/templates/hono/dist/preactpress-content/404.json +8 -0
- package/templates/hono/dist/preactpress-content/README.json +26 -0
- package/templates/hono/dist/preactpress-content/about.json +15 -0
- package/templates/hono/dist/preactpress-content/de__about.json +15 -0
- package/templates/hono/dist/preactpress-content/de__guide__commands.json +36 -0
- package/templates/hono/dist/preactpress-content/de__guide__configuration.json +41 -0
- package/templates/hono/dist/preactpress-content/de__guide__deploy.json +56 -0
- package/templates/hono/dist/preactpress-content/de__guide__first-five-minutes.json +36 -0
- package/templates/hono/dist/preactpress-content/de__guide__getting-started.json +51 -0
- package/templates/hono/dist/preactpress-content/de__guide__routing.json +61 -0
- package/templates/hono/dist/preactpress-content/de__guide__seiten-erstellen.json +71 -0
- package/templates/hono/dist/preactpress-content/de__guide__what-is-preactpress.json +51 -0
- package/templates/hono/dist/preactpress-content/de__markdown-examples.json +131 -0
- package/templates/hono/dist/preactpress-content/de__parts__include-body.json +16 -0
- package/templates/hono/dist/preactpress-content/de__tags__markdown.json +16 -0
- package/templates/hono/dist/preactpress-content/guide__commands.json +36 -0
- package/templates/hono/dist/preactpress-content/guide__configuration.json +51 -0
- package/templates/hono/dist/preactpress-content/guide__creating-pages.json +71 -0
- package/templates/hono/dist/preactpress-content/guide__deploy.json +56 -0
- package/templates/hono/dist/preactpress-content/guide__first-five-minutes.json +36 -0
- package/templates/hono/dist/preactpress-content/guide__getting-started.json +51 -0
- package/templates/hono/dist/preactpress-content/guide__routing.json +61 -0
- package/templates/hono/dist/preactpress-content/guide__what-is-preactpress.json +51 -0
- package/templates/hono/dist/preactpress-content/markdown-examples.json +141 -0
- package/templates/hono/dist/preactpress-content/partials__shared-note.json +10 -0
- package/templates/hono/dist/preactpress-content/parts__include-body.json +16 -0
- package/templates/hono/dist/preactpress-content/tags__markdown.json +16 -0
- package/templates/hono/dist/preactpress-search.json +242 -0
- package/templates/hono/dist/preactpress-theme.js +1 -0
- package/templates/hono/dist/tags/markdown/index.html +32 -0
- package/templates/hono/guide/commands.md +44 -0
- package/templates/hono/guide/configuration.md +177 -0
- package/templates/hono/guide/creating-pages.md +171 -0
- package/templates/hono/guide/deploy.md +197 -0
- package/templates/hono/guide/first-five-minutes.md +82 -0
- package/templates/hono/guide/getting-started.md +146 -0
- package/templates/hono/guide/routing.md +263 -0
- package/templates/hono/guide/what-is-preactpress.md +87 -0
- package/templates/hono/index.html +18 -0
- package/templates/hono/index.mdx +51 -0
- package/templates/hono/interactive.mdx +32 -0
- package/templates/hono/markdown-examples.md +160 -0
- package/templates/hono/package.json +15 -0
- package/templates/hono/partials/shared-note.md +3 -0
- package/templates/hono/parts/include-body.md +9 -0
- package/templates/hono/pnpm-lock.yaml +2917 -0
- package/templates/hono/snippets/greet.ts +3 -0
- package/templates/magazine/.preactpress/config.ts +36 -0
- package/templates/magazine/.preactpress/theme/Layout.tsx +319 -0
- package/templates/magazine/.preactpress/theme/TeaserGrid.tsx +39 -0
- package/templates/magazine/.preactpress/theme/ThemeToggle.tsx +73 -0
- package/templates/magazine/.preactpress/theme/magazine.css +587 -0
- package/templates/magazine/article-markets.md +24 -0
- package/templates/magazine/article-tech.mdx +35 -0
- package/templates/magazine/index.data.ts +19 -0
- package/templates/magazine/index.html +14 -0
- package/templates/magazine/index.mdx +13 -0
- package/templates/magazine/package.json +15 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ComponentType } from 'preact'
|
|
2
|
+
import type { OutlineItem, ResolvedI18n, ResolvedLocale, SiteData, ThemeConfig } from '../node/siteConfig.js'
|
|
3
|
+
|
|
4
|
+
interface BasePageView {
|
|
5
|
+
title?: string
|
|
6
|
+
description?: string
|
|
7
|
+
tags?: string[]
|
|
8
|
+
image?: string
|
|
9
|
+
pageType?: 'website' | 'article'
|
|
10
|
+
meta: Record<string, unknown>
|
|
11
|
+
headings: OutlineItem[]
|
|
12
|
+
relativePath?: string
|
|
13
|
+
lastUpdated?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface HtmlPageView extends BasePageView {
|
|
17
|
+
kind: 'markdown'
|
|
18
|
+
html: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface MdxPageView extends BasePageView {
|
|
22
|
+
kind: 'mdx'
|
|
23
|
+
Component: ComponentType<{ components?: Record<string, ComponentType<Record<string, unknown>>> }>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type PageView = HtmlPageView | MdxPageView
|
|
27
|
+
|
|
28
|
+
export interface LayoutProps {
|
|
29
|
+
site: SiteData
|
|
30
|
+
themeConfig: ThemeConfig
|
|
31
|
+
routePath: string
|
|
32
|
+
page?: PageView
|
|
33
|
+
i18n?: ResolvedI18n
|
|
34
|
+
locale?: ResolvedLocale
|
|
35
|
+
locales?: ResolvedLocale[]
|
|
36
|
+
localizeRoute?: (locale: ResolvedLocale) => string
|
|
37
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { useEffect } from 'preact/hooks'
|
|
2
|
+
import type { ResolvedI18n, SiteData } from '../node/siteConfig.js'
|
|
3
|
+
import {
|
|
4
|
+
resolvePageHeadMeta,
|
|
5
|
+
titleTemplateFromMeta,
|
|
6
|
+
type PageMetaInput
|
|
7
|
+
} from '../shared/pageMeta.js'
|
|
8
|
+
import { headTagsFromMeta } from '../shared/pageHead.js'
|
|
9
|
+
import type { HeadTag } from '../node/siteConfig.js'
|
|
10
|
+
import { canonicalUrl, publicUrl } from '../shared/url.js'
|
|
11
|
+
import { localizedRouteForLocale, siteForRoute } from '../shared/locale.js'
|
|
12
|
+
|
|
13
|
+
function upsertMeta(
|
|
14
|
+
selector: 'name' | 'property',
|
|
15
|
+
key: string,
|
|
16
|
+
content: string
|
|
17
|
+
): void {
|
|
18
|
+
if (!content) return
|
|
19
|
+
let el = document.head.querySelector(
|
|
20
|
+
`meta[${selector}="${key}"]`
|
|
21
|
+
) as HTMLMetaElement | null
|
|
22
|
+
if (!el) {
|
|
23
|
+
el = document.createElement('meta')
|
|
24
|
+
el.setAttribute(selector, key)
|
|
25
|
+
document.head.appendChild(el)
|
|
26
|
+
}
|
|
27
|
+
el.content = content
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function removeMeta(selector: 'name' | 'property', key: string): void {
|
|
31
|
+
document.head
|
|
32
|
+
.querySelectorAll(`meta[${selector}="${key}"]`)
|
|
33
|
+
.forEach((el) => el.remove())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function appendMeta(selector: 'name' | 'property', key: string, content: string): void {
|
|
37
|
+
if (!content) return
|
|
38
|
+
const el = document.createElement('meta')
|
|
39
|
+
el.setAttribute(selector, key)
|
|
40
|
+
el.content = content
|
|
41
|
+
document.head.appendChild(el)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function upsertCanonical(href: string): void {
|
|
45
|
+
if (!href) return
|
|
46
|
+
let el = document.head.querySelector('link[rel="canonical"]') as HTMLLinkElement | null
|
|
47
|
+
if (!el) {
|
|
48
|
+
el = document.createElement('link')
|
|
49
|
+
el.rel = 'canonical'
|
|
50
|
+
document.head.appendChild(el)
|
|
51
|
+
}
|
|
52
|
+
el.href = href
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function removeCanonical(): void {
|
|
56
|
+
document.head
|
|
57
|
+
.querySelectorAll('link[rel="canonical"]')
|
|
58
|
+
.forEach((el) => el.remove())
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function replaceAlternates(opts: {
|
|
62
|
+
site: SiteData
|
|
63
|
+
i18n: ResolvedI18n | undefined
|
|
64
|
+
route: string
|
|
65
|
+
routes?: ReadonlySet<string>
|
|
66
|
+
}): void {
|
|
67
|
+
document.head
|
|
68
|
+
.querySelectorAll('link[rel="alternate"][hreflang]')
|
|
69
|
+
.forEach((el) => el.remove())
|
|
70
|
+
if (!opts.site.url || !opts.i18n) return
|
|
71
|
+
for (const locale of opts.i18n.locales) {
|
|
72
|
+
const route = localizedRouteForLocale(opts.route, locale, opts.i18n, opts.routes)
|
|
73
|
+
if (opts.routes && !opts.routes.has(route)) continue
|
|
74
|
+
const el = document.createElement('link')
|
|
75
|
+
el.rel = 'alternate'
|
|
76
|
+
el.hreflang = locale.lang
|
|
77
|
+
el.href = canonicalUrl({ url: opts.site.url, base: opts.site.base, route })
|
|
78
|
+
document.head.appendChild(el)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function upsertHeadTag(tag: HeadTag): void {
|
|
83
|
+
const [name, attrs, content] = tag
|
|
84
|
+
if (name === 'meta') {
|
|
85
|
+
const key = 'name' in attrs && attrs.name ? 'name' : 'property' in attrs ? 'property' : undefined
|
|
86
|
+
if (key && typeof attrs[key] === 'string') {
|
|
87
|
+
upsertMeta(key as 'name' | 'property', String(attrs[key]), String(attrs.content ?? ''))
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (name === 'link' && attrs.rel && typeof attrs.href === 'string') {
|
|
92
|
+
let el = document.head.querySelector(
|
|
93
|
+
`link[rel="${attrs.rel}"]${attrs.hreflang ? `[hreflang="${attrs.hreflang}"]` : ''}`
|
|
94
|
+
) as HTMLLinkElement | null
|
|
95
|
+
if (!el) {
|
|
96
|
+
el = document.createElement('link')
|
|
97
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
98
|
+
if (value != null && value !== false) el.setAttribute(key, String(value))
|
|
99
|
+
}
|
|
100
|
+
document.head.appendChild(el)
|
|
101
|
+
} else {
|
|
102
|
+
el.href = String(attrs.href)
|
|
103
|
+
}
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
if (name === 'script') {
|
|
107
|
+
const id = typeof attrs.id === 'string' ? attrs.id : undefined
|
|
108
|
+
let el = id ? (document.getElementById(id) as HTMLScriptElement | null) : null
|
|
109
|
+
if (!el) {
|
|
110
|
+
el = document.createElement('script')
|
|
111
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
112
|
+
if (value != null && value !== false) el.setAttribute(key, String(value))
|
|
113
|
+
}
|
|
114
|
+
el.textContent = content ?? ''
|
|
115
|
+
document.head.appendChild(el)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function resolveMetaImage(site: SiteData, image: string | undefined): string | undefined {
|
|
121
|
+
if (!image) return undefined
|
|
122
|
+
if (/^(?:[a-z]+:)?\/\//i.test(image)) return image
|
|
123
|
+
return site.url
|
|
124
|
+
? `${site.url}${publicUrl(site.base, image)}`
|
|
125
|
+
: publicUrl(site.base, image)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function usePageHead(opts: {
|
|
129
|
+
site: SiteData
|
|
130
|
+
i18n?: ResolvedI18n
|
|
131
|
+
routes?: ReadonlySet<string>
|
|
132
|
+
route: string
|
|
133
|
+
page: PageMetaInput | undefined
|
|
134
|
+
}): void {
|
|
135
|
+
const { site, i18n, routes, route, page } = opts
|
|
136
|
+
const activeSite = siteForRoute(site, route, i18n)
|
|
137
|
+
const pageTitle = page?.title
|
|
138
|
+
const pageDescription = page?.description
|
|
139
|
+
const pageTags = page?.tags
|
|
140
|
+
const pageImage = page?.image
|
|
141
|
+
const pageType = page?.pageType
|
|
142
|
+
const pageKind = page?.kind
|
|
143
|
+
const pageHtml = page?.kind === 'markdown' ? page.html : undefined
|
|
144
|
+
const pageMeta = page?.meta
|
|
145
|
+
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
const head = resolvePageHeadMeta(
|
|
148
|
+
pageKind === 'markdown'
|
|
149
|
+
? {
|
|
150
|
+
title: pageTitle,
|
|
151
|
+
titleTemplate: titleTemplateFromMeta(pageMeta),
|
|
152
|
+
description: pageDescription,
|
|
153
|
+
tags: pageTags,
|
|
154
|
+
image: pageImage,
|
|
155
|
+
pageType,
|
|
156
|
+
kind: 'markdown',
|
|
157
|
+
html: pageHtml
|
|
158
|
+
}
|
|
159
|
+
: pageKind
|
|
160
|
+
? {
|
|
161
|
+
title: pageTitle,
|
|
162
|
+
titleTemplate: titleTemplateFromMeta(pageMeta),
|
|
163
|
+
description: pageDescription,
|
|
164
|
+
tags: pageTags,
|
|
165
|
+
image: pageImage,
|
|
166
|
+
pageType,
|
|
167
|
+
kind: pageKind
|
|
168
|
+
}
|
|
169
|
+
: undefined,
|
|
170
|
+
activeSite
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
for (const tag of headTagsFromMeta(pageMeta)) upsertHeadTag(tag)
|
|
174
|
+
|
|
175
|
+
document.title = head.title
|
|
176
|
+
|
|
177
|
+
upsertMeta('name', 'description', head.description)
|
|
178
|
+
upsertMeta('property', 'og:title', head.title)
|
|
179
|
+
upsertMeta('property', 'og:description', head.description)
|
|
180
|
+
upsertMeta('property', 'og:type', head.pageType)
|
|
181
|
+
upsertMeta('name', 'twitter:card', head.image ? 'summary_large_image' : 'summary')
|
|
182
|
+
upsertMeta('name', 'twitter:title', head.title)
|
|
183
|
+
upsertMeta('name', 'twitter:description', head.description)
|
|
184
|
+
removeMeta('name', 'keywords')
|
|
185
|
+
removeMeta('property', 'article:tag')
|
|
186
|
+
for (const tag of head.tags) appendMeta('property', 'article:tag', tag)
|
|
187
|
+
|
|
188
|
+
const image = resolveMetaImage(activeSite, head.image)
|
|
189
|
+
if (image) {
|
|
190
|
+
upsertMeta('property', 'og:image', image)
|
|
191
|
+
upsertMeta('name', 'twitter:image', image)
|
|
192
|
+
} else {
|
|
193
|
+
removeMeta('property', 'og:image')
|
|
194
|
+
removeMeta('name', 'twitter:image')
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const canonical = canonicalUrl({ url: activeSite.url, base: activeSite.base, route })
|
|
198
|
+
if (canonical) {
|
|
199
|
+
upsertMeta('property', 'og:url', canonical)
|
|
200
|
+
upsertCanonical(canonical)
|
|
201
|
+
} else {
|
|
202
|
+
removeMeta('property', 'og:url')
|
|
203
|
+
removeCanonical()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
replaceAlternates({ site: activeSite, i18n, route, routes })
|
|
207
|
+
|
|
208
|
+
if (document.documentElement.lang !== activeSite.lang) {
|
|
209
|
+
document.documentElement.lang = activeSite.lang
|
|
210
|
+
}
|
|
211
|
+
}, [activeSite, i18n, route, routes, pageTitle, pageDescription, pageTags, pageImage, pageType, pageKind, pageHtml, pageMeta])
|
|
212
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
|
+
import { publicUrl } from '../shared/url.js'
|
|
3
|
+
|
|
4
|
+
export interface SearchEntry {
|
|
5
|
+
route: string
|
|
6
|
+
locale?: string
|
|
7
|
+
title?: string
|
|
8
|
+
description?: string
|
|
9
|
+
excerpt?: string
|
|
10
|
+
tags?: string[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useSiteSearch(base: string, query: string, locale?: string): SearchEntry[] {
|
|
14
|
+
const [entries, setEntries] = useState<SearchEntry[]>([])
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
let cancelled = false
|
|
18
|
+
fetch(publicUrl(base, 'preactpress-search.json'), { credentials: 'same-origin' })
|
|
19
|
+
.then((res) => res.ok ? res.json() : [])
|
|
20
|
+
.then((data) => {
|
|
21
|
+
if (!cancelled && Array.isArray(data)) setEntries(data as SearchEntry[])
|
|
22
|
+
})
|
|
23
|
+
.catch(() => {
|
|
24
|
+
if (!cancelled) setEntries([])
|
|
25
|
+
})
|
|
26
|
+
return () => {
|
|
27
|
+
cancelled = true
|
|
28
|
+
}
|
|
29
|
+
}, [base])
|
|
30
|
+
|
|
31
|
+
return useMemo(() => {
|
|
32
|
+
const needle = query.trim().toLowerCase()
|
|
33
|
+
if (!needle) return []
|
|
34
|
+
return entries
|
|
35
|
+
.filter((entry) => !locale || entry.locale === locale)
|
|
36
|
+
.map((entry) => ({ entry, score: scoreEntry(entry, needle) }))
|
|
37
|
+
.filter(({ score }) => score > 0)
|
|
38
|
+
.sort((a, b) => b.score - a.score)
|
|
39
|
+
.slice(0, 8)
|
|
40
|
+
.map(({ entry }) => entry)
|
|
41
|
+
}, [entries, locale, query])
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function scoreEntry(entry: SearchEntry, query: string): number {
|
|
45
|
+
const title = entry.title?.toLowerCase() ?? ''
|
|
46
|
+
const tags = entry.tags?.join(' ').toLowerCase() ?? ''
|
|
47
|
+
const description = entry.description?.toLowerCase() ?? ''
|
|
48
|
+
const excerpt = entry.excerpt?.toLowerCase() ?? ''
|
|
49
|
+
let score = 0
|
|
50
|
+
if (title === query) score += 20
|
|
51
|
+
if (title.includes(query)) score += 10
|
|
52
|
+
if (tags.includes(query)) score += 6
|
|
53
|
+
if (description.includes(query)) score += 4
|
|
54
|
+
if (excerpt.includes(query)) score += 2
|
|
55
|
+
if (entry.route.toLowerCase().includes(query)) score += 1
|
|
56
|
+
return score
|
|
57
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module '@docsearch/css'
|
|
4
|
+
|
|
5
|
+
declare module '*.mdx' {
|
|
6
|
+
import type { ComponentType } from 'preact'
|
|
7
|
+
const MdxPage: ComponentType<{
|
|
8
|
+
components?: Record<string, ComponentType<Record<string, unknown>>>
|
|
9
|
+
}>
|
|
10
|
+
export default MdxPage
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module 'virtual:preactpress-pages' {
|
|
14
|
+
import type { ComponentType } from 'preact'
|
|
15
|
+
|
|
16
|
+
export const pages: Record<
|
|
17
|
+
string,
|
|
18
|
+
| {
|
|
19
|
+
kind: 'markdown'
|
|
20
|
+
meta: Record<string, unknown>
|
|
21
|
+
html: string
|
|
22
|
+
title?: string
|
|
23
|
+
description?: string
|
|
24
|
+
tags?: string[]
|
|
25
|
+
image?: string
|
|
26
|
+
pageType?: 'website' | 'article'
|
|
27
|
+
headings: { id: string; text: string; level: number }[]
|
|
28
|
+
relativePath?: string
|
|
29
|
+
lastUpdated?: string
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
kind: 'mdx'
|
|
33
|
+
Component: ComponentType<{
|
|
34
|
+
components?: Record<string, ComponentType<Record<string, unknown>>>
|
|
35
|
+
}>
|
|
36
|
+
meta: Record<string, unknown>
|
|
37
|
+
title?: string
|
|
38
|
+
description?: string
|
|
39
|
+
tags?: string[]
|
|
40
|
+
image?: string
|
|
41
|
+
pageType?: 'website' | 'article'
|
|
42
|
+
headings: { id: string; text: string; level: number }[]
|
|
43
|
+
relativePath?: string
|
|
44
|
+
lastUpdated?: string
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
export const pagesMeta: Record<
|
|
48
|
+
string,
|
|
49
|
+
{
|
|
50
|
+
kind: 'markdown' | 'mdx'
|
|
51
|
+
meta: Record<string, unknown>
|
|
52
|
+
title?: string
|
|
53
|
+
description?: string
|
|
54
|
+
tags?: string[]
|
|
55
|
+
image?: string
|
|
56
|
+
pageType?: 'website' | 'article'
|
|
57
|
+
headings: { id: string; text: string; level: number }[]
|
|
58
|
+
relativePath?: string
|
|
59
|
+
lastUpdated?: string
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
export const mdxLoaders: Record<
|
|
63
|
+
string,
|
|
64
|
+
() => Promise<{
|
|
65
|
+
default: ComponentType<{
|
|
66
|
+
components?: Record<string, ComponentType<Record<string, unknown>>>
|
|
67
|
+
}>
|
|
68
|
+
}>
|
|
69
|
+
>
|
|
70
|
+
export const routes: string[]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare module 'virtual:preactpress-site' {
|
|
74
|
+
export const mpa: boolean
|
|
75
|
+
export const site: {
|
|
76
|
+
title: string
|
|
77
|
+
description: string
|
|
78
|
+
base: string
|
|
79
|
+
lang: string
|
|
80
|
+
url?: string
|
|
81
|
+
}
|
|
82
|
+
export const themeConfig: {
|
|
83
|
+
logo?: import('../node/siteConfig.js').ThemeLogo
|
|
84
|
+
labels?: import('../node/siteConfig.js').ThemeLabels
|
|
85
|
+
nav?: import('../node/siteConfig.js').NavItem[]
|
|
86
|
+
sidebar?: import('../node/siteConfig.js').SidebarConfig
|
|
87
|
+
outline?: boolean | import('../shared/pageChrome.js').PageOutlineConfig
|
|
88
|
+
search?: import('../shared/search.js').SearchConfig
|
|
89
|
+
socialLinks?: import('../shared/socialIcons.js').SocialLink[]
|
|
90
|
+
tags?: boolean
|
|
91
|
+
footer?: string
|
|
92
|
+
editLink?: { pattern: string; text?: string }
|
|
93
|
+
lastUpdated?: boolean
|
|
94
|
+
}
|
|
95
|
+
export const i18n: import('../node/siteConfig.js').ResolvedI18n | undefined
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
declare module 'virtual:preactpress-layout' {
|
|
99
|
+
import type { FunctionalComponent } from 'preact'
|
|
100
|
+
import type { LayoutProps } from './types.js'
|
|
101
|
+
const Layout: FunctionalComponent<LayoutProps>
|
|
102
|
+
export default Layout
|
|
103
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const CONTENT_CHUNK_DIR = 'preactpress-content'
|
|
2
|
+
|
|
3
|
+
export function encodeContentRoute(route: string): string {
|
|
4
|
+
if (route === '/') return '_index.json'
|
|
5
|
+
const clean = route.replace(/^\/+|\/+$/g, '')
|
|
6
|
+
return `${clean
|
|
7
|
+
.split('/')
|
|
8
|
+
.map((part) => encodeURIComponent(part))
|
|
9
|
+
.join('__')}.json`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function contentChunkPath(route: string): string {
|
|
13
|
+
return `${CONTENT_CHUNK_DIR}/${encodeContentRoute(route)}`
|
|
14
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** Author metadata for articles, magazines, and blogs. */
|
|
2
|
+
export interface Author {
|
|
3
|
+
name: string
|
|
4
|
+
slug?: string
|
|
5
|
+
avatar?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Category or rubric metadata for editorial content. */
|
|
9
|
+
export interface ContentCategory {
|
|
10
|
+
name: string
|
|
11
|
+
slug?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Common article frontmatter fields beyond built-in page metadata. */
|
|
15
|
+
export interface ArticleFrontmatter {
|
|
16
|
+
title?: string
|
|
17
|
+
description?: string
|
|
18
|
+
tags?: string[]
|
|
19
|
+
author?: string | Author
|
|
20
|
+
category?: string | ContentCategory
|
|
21
|
+
readTime?: string
|
|
22
|
+
draft?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Normalized article record produced from content loaders or hooks. */
|
|
26
|
+
export interface ArticlePost {
|
|
27
|
+
title: string
|
|
28
|
+
route: string
|
|
29
|
+
url: string
|
|
30
|
+
description?: string
|
|
31
|
+
tags?: string[]
|
|
32
|
+
author?: Author
|
|
33
|
+
category?: ContentCategory
|
|
34
|
+
readTime?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function parseAuthor(value: unknown): Author | undefined {
|
|
38
|
+
if (typeof value === 'string' && value.trim()) {
|
|
39
|
+
return { name: value.trim() }
|
|
40
|
+
}
|
|
41
|
+
if (!value || typeof value !== 'object') return undefined
|
|
42
|
+
const record = value as Record<string, unknown>
|
|
43
|
+
const name = typeof record.name === 'string' ? record.name.trim() : ''
|
|
44
|
+
if (!name) return undefined
|
|
45
|
+
const slug = typeof record.slug === 'string' && record.slug.trim() ? record.slug.trim() : undefined
|
|
46
|
+
const avatar =
|
|
47
|
+
typeof record.avatar === 'string' && record.avatar.trim() ? record.avatar.trim() : undefined
|
|
48
|
+
return { name, slug, avatar }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function parseCategory(value: unknown): ContentCategory | undefined {
|
|
52
|
+
if (typeof value === 'string' && value.trim()) {
|
|
53
|
+
return { name: value.trim() }
|
|
54
|
+
}
|
|
55
|
+
if (!value || typeof value !== 'object') return undefined
|
|
56
|
+
const record = value as Record<string, unknown>
|
|
57
|
+
const name = typeof record.name === 'string' ? record.name.trim() : ''
|
|
58
|
+
if (!name) return undefined
|
|
59
|
+
const slug = typeof record.slug === 'string' && record.slug.trim() ? record.slug.trim() : undefined
|
|
60
|
+
return { name, slug }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function articleFromFrontmatter(opts: {
|
|
64
|
+
route: string
|
|
65
|
+
url: string
|
|
66
|
+
title?: string
|
|
67
|
+
description?: string
|
|
68
|
+
tags?: string[]
|
|
69
|
+
frontmatter: Record<string, unknown>
|
|
70
|
+
}): ArticlePost {
|
|
71
|
+
const fm = opts.frontmatter as ArticleFrontmatter
|
|
72
|
+
const title = (opts.title ?? fm.title ?? 'Untitled').trim()
|
|
73
|
+
const description = (opts.description ?? fm.description)?.trim() || undefined
|
|
74
|
+
const tags = (opts.tags ?? fm.tags)?.filter((tag) => tag.trim()).map((tag) => tag.trim())
|
|
75
|
+
return {
|
|
76
|
+
title,
|
|
77
|
+
route: opts.route,
|
|
78
|
+
url: opts.url,
|
|
79
|
+
description,
|
|
80
|
+
tags,
|
|
81
|
+
author: parseAuthor(fm.author),
|
|
82
|
+
category: parseCategory(fm.category) ?? (tags?.[0] ? { name: tags[0] } : undefined),
|
|
83
|
+
readTime: typeof fm.readTime === 'string' && fm.readTime.trim() ? fm.readTime.trim() : undefined
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type IgnoreDeadLinks =
|
|
2
|
+
| boolean
|
|
3
|
+
| string[]
|
|
4
|
+
| ((href: string, ctx: { from: string; route?: string }) => boolean)
|
|
5
|
+
|
|
6
|
+
function patternToRegExp(pattern: string): RegExp {
|
|
7
|
+
const escaped = pattern
|
|
8
|
+
.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
|
|
9
|
+
.replace(/\*\*/g, '§§')
|
|
10
|
+
.replace(/\*/g, '[^/]*')
|
|
11
|
+
.replace(/§§/g, '.*')
|
|
12
|
+
return new RegExp(`^${escaped}$`)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function matchesPattern(pattern: string, href: string, route?: string): boolean {
|
|
16
|
+
if (pattern === href || (route && pattern === route)) return true
|
|
17
|
+
if (pattern.includes('*')) {
|
|
18
|
+
const re = patternToRegExp(pattern)
|
|
19
|
+
return re.test(href) || (route ? re.test(route) : false)
|
|
20
|
+
}
|
|
21
|
+
return href.includes(pattern) || (route ? route.includes(pattern) : false)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function shouldIgnoreDeadLink(
|
|
25
|
+
href: string,
|
|
26
|
+
ignore: IgnoreDeadLinks | undefined,
|
|
27
|
+
ctx: { from: string; route?: string }
|
|
28
|
+
): boolean {
|
|
29
|
+
if (!ignore) return false
|
|
30
|
+
if (ignore === true) return true
|
|
31
|
+
if (typeof ignore === 'function') return ignore(href, ctx)
|
|
32
|
+
return ignore.some((pattern) => matchesPattern(pattern, href, ctx.route))
|
|
33
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export { contentChunkPath, encodeContentRoute } from './contentChunk.js'
|
|
2
|
+
export { escapeAttr, escapeHtml } from './escapeHtml.js'
|
|
3
|
+
export {
|
|
4
|
+
PAGE_LAYOUTS,
|
|
5
|
+
DEFAULT_TITLE_TEMPLATE,
|
|
6
|
+
excerptFromHtml,
|
|
7
|
+
formatTitleTemplate,
|
|
8
|
+
isPageLayout,
|
|
9
|
+
pageLayoutFromMeta,
|
|
10
|
+
resolvePageHeadMeta,
|
|
11
|
+
resolvePageMeta,
|
|
12
|
+
titleTemplateFromMeta,
|
|
13
|
+
type PageFrontmatter,
|
|
14
|
+
type PageLayout,
|
|
15
|
+
type PageMetaInput
|
|
16
|
+
} from './pageMeta.js'
|
|
17
|
+
export {
|
|
18
|
+
articleFromFrontmatter,
|
|
19
|
+
parseAuthor,
|
|
20
|
+
parseCategory,
|
|
21
|
+
type ArticleFrontmatter,
|
|
22
|
+
type ArticlePost,
|
|
23
|
+
type Author,
|
|
24
|
+
type ContentCategory
|
|
25
|
+
} from './contentSchema.js'
|
|
26
|
+
export { headTagsFromMeta } from './pageHead.js'
|
|
27
|
+
export {
|
|
28
|
+
allSidebarGroups,
|
|
29
|
+
flattenNavLeafItems,
|
|
30
|
+
flattenSidebarItems,
|
|
31
|
+
flattenSidebarLeafItems,
|
|
32
|
+
isPathSidebarConfig,
|
|
33
|
+
resolveSidebarForRoute,
|
|
34
|
+
type SidebarConfig
|
|
35
|
+
} from './sidebar.js'
|
|
36
|
+
export {
|
|
37
|
+
applyRouteRewrites,
|
|
38
|
+
normalizeRewriteRoute,
|
|
39
|
+
type RouteRewrites
|
|
40
|
+
} from './rewrites.js'
|
|
41
|
+
export {
|
|
42
|
+
defaultLabelsForLang,
|
|
43
|
+
resolveThemeLabels,
|
|
44
|
+
type ResolvedThemeLabels
|
|
45
|
+
} from './themeLabels.js'
|
|
46
|
+
export {
|
|
47
|
+
filterHeadingsForOutline,
|
|
48
|
+
parseFeatures,
|
|
49
|
+
parseHero,
|
|
50
|
+
resolvePageChrome,
|
|
51
|
+
type Feature,
|
|
52
|
+
type FeatureIcon,
|
|
53
|
+
type Hero,
|
|
54
|
+
type HeroAction,
|
|
55
|
+
type PageAside,
|
|
56
|
+
type PageOutlineConfig,
|
|
57
|
+
type PageOutlineLevels,
|
|
58
|
+
type ResolvedPageChrome,
|
|
59
|
+
type ThemeableImage
|
|
60
|
+
} from './pageChrome.js'
|
|
61
|
+
export {
|
|
62
|
+
algoliaOptionsFromSearch,
|
|
63
|
+
getRelativeDocSearchUrl,
|
|
64
|
+
isAlgoliaSearchEnabled,
|
|
65
|
+
isLocalSearchEnabled,
|
|
66
|
+
resolveAlgoliaOptions,
|
|
67
|
+
resolveSearchProvider,
|
|
68
|
+
validateAlgoliaCredentials,
|
|
69
|
+
type AlgoliaSearchConfig,
|
|
70
|
+
type AlgoliaSearchOptions,
|
|
71
|
+
type LocalSearchConfig,
|
|
72
|
+
type SearchConfig,
|
|
73
|
+
type SearchProvider
|
|
74
|
+
} from './search.js'
|
|
75
|
+
export {
|
|
76
|
+
socialIconSvg,
|
|
77
|
+
socialLinkLabel,
|
|
78
|
+
type SocialLink,
|
|
79
|
+
type SocialLinkIcon
|
|
80
|
+
} from './socialIcons.js'
|
|
81
|
+
export { normalizeRoute, routeFromPathname } from './route.js'
|
|
82
|
+
export { slugifySegment, uniqueSlug } from './slug.js'
|
|
83
|
+
export { slugifyTagSegment, tagIndexPageRoute } from './tags.js'
|