@kamod-ch/preactpress 1.0.0 → 1.0.3
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/README.md +87 -49
- package/bin/preactpress.mjs +5 -5
- package/dist/client/app.d.ts +1 -1
- package/dist/client/app.d.ts.map +1 -1
- package/dist/client/app.js +55 -42
- package/dist/client/app.js.map +1 -1
- package/dist/client/entry-client.js +11 -12
- package/dist/client/entry-client.js.map +1 -1
- package/dist/client/entry-ssr.d.ts +2 -2
- package/dist/client/entry-ssr.d.ts.map +1 -1
- package/dist/client/entry-ssr.js +16 -16
- package/dist/client/entry-ssr.js.map +1 -1
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/loadPage.d.ts +2 -1
- package/dist/client/loadPage.d.ts.map +1 -1
- package/dist/client/loadPage.js +15 -12
- package/dist/client/loadPage.js.map +1 -1
- package/dist/client/prefetchLinks.js +4 -4
- package/dist/client/prefetchLinks.js.map +1 -1
- package/dist/client/theme-default/AlgoliaSearch.d.ts +3 -3
- package/dist/client/theme-default/AlgoliaSearch.d.ts.map +1 -1
- package/dist/client/theme-default/AlgoliaSearch.js +15 -15
- package/dist/client/theme-default/AlgoliaSearch.js.map +1 -1
- package/dist/client/theme-default/Features.d.ts +2 -2
- package/dist/client/theme-default/Features.d.ts.map +1 -1
- package/dist/client/theme-default/Features.js +10 -8
- package/dist/client/theme-default/Features.js.map +1 -1
- package/dist/client/theme-default/Hero.d.ts +2 -2
- package/dist/client/theme-default/Hero.d.ts.map +1 -1
- package/dist/client/theme-default/Hero.js +9 -7
- package/dist/client/theme-default/Hero.js.map +1 -1
- package/dist/client/theme-default/Layout.d.ts +3 -3
- package/dist/client/theme-default/Layout.d.ts.map +1 -1
- package/dist/client/theme-default/Layout.js +56 -99
- package/dist/client/theme-default/Layout.js.map +1 -1
- package/dist/client/theme-default/Logo.d.ts +2 -2
- package/dist/client/theme-default/Logo.d.ts.map +1 -1
- package/dist/client/theme-default/Logo.js +8 -8
- package/dist/client/theme-default/Logo.js.map +1 -1
- package/dist/client/theme-default/NavLinks.d.ts +2 -2
- package/dist/client/theme-default/NavLinks.d.ts.map +1 -1
- package/dist/client/theme-default/NavLinks.js +3 -3
- package/dist/client/theme-default/NavLinks.js.map +1 -1
- package/dist/client/theme-default/SidebarNav.d.ts +2 -2
- package/dist/client/theme-default/SidebarNav.d.ts.map +1 -1
- package/dist/client/theme-default/SidebarNav.js +3 -3
- package/dist/client/theme-default/SidebarNav.js.map +1 -1
- package/dist/client/theme-default/SocialLinks.d.ts +2 -2
- package/dist/client/theme-default/SocialLinks.d.ts.map +1 -1
- package/dist/client/theme-default/SocialLinks.js +1 -1
- package/dist/client/theme-default/SocialLinks.js.map +1 -1
- package/dist/client/theme-default/ThemeToggle.d.ts +2 -3
- package/dist/client/theme-default/ThemeToggle.d.ts.map +1 -1
- package/dist/client/theme-default/ThemeToggle.js +2 -30
- package/dist/client/theme-default/ThemeToggle.js.map +1 -1
- package/dist/client/theme-default/index.d.ts +1 -1
- package/dist/client/theme-default/index.d.ts.map +1 -1
- package/dist/client/theme-default/index.js +1 -1
- package/dist/client/theme-default/index.js.map +1 -1
- package/dist/client/theme-utils.d.ts +24 -0
- package/dist/client/theme-utils.d.ts.map +1 -0
- package/dist/client/theme-utils.js +107 -0
- package/dist/client/theme-utils.js.map +1 -0
- package/dist/client/types.d.ts +5 -5
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/usePageHead.d.ts +2 -2
- package/dist/client/usePageHead.d.ts.map +1 -1
- package/dist/client/usePageHead.js +61 -56
- package/dist/client/usePageHead.js.map +1 -1
- package/dist/client/useSiteSearch.d.ts.map +1 -1
- package/dist/client/useSiteSearch.js +8 -8
- package/dist/client/useSiteSearch.js.map +1 -1
- package/dist/node/build.d.ts +1 -1
- package/dist/node/build.d.ts.map +1 -1
- package/dist/node/build.js +105 -96
- package/dist/node/build.js.map +1 -1
- package/dist/node/buildCache.d.ts.map +1 -1
- package/dist/node/buildCache.js +7 -7
- package/dist/node/buildCache.js.map +1 -1
- package/dist/node/check.d.ts +1 -1
- package/dist/node/check.d.ts.map +1 -1
- package/dist/node/check.js +52 -52
- package/dist/node/check.js.map +1 -1
- package/dist/node/cli.js +61 -64
- package/dist/node/cli.js.map +1 -1
- package/dist/node/config-helpers.d.ts +4 -4
- package/dist/node/config-helpers.d.ts.map +1 -1
- package/dist/node/config-helpers.js +1 -1
- package/dist/node/config-helpers.js.map +1 -1
- package/dist/node/config.d.ts +4 -4
- package/dist/node/config.d.ts.map +1 -1
- package/dist/node/config.js +37 -40
- package/dist/node/config.js.map +1 -1
- package/dist/node/content.d.ts +4 -4
- package/dist/node/content.d.ts.map +1 -1
- package/dist/node/content.js +28 -28
- package/dist/node/content.js.map +1 -1
- package/dist/node/createContentLoader.d.ts +1 -1
- package/dist/node/createContentLoader.d.ts.map +1 -1
- package/dist/node/createContentLoader.js +3 -3
- package/dist/node/createContentLoader.js.map +1 -1
- package/dist/node/devCss.d.ts +1 -1
- package/dist/node/devCss.d.ts.map +1 -1
- package/dist/node/devCss.js +5 -6
- package/dist/node/devCss.js.map +1 -1
- package/dist/node/devSsr.d.ts +3 -3
- package/dist/node/devSsr.d.ts.map +1 -1
- package/dist/node/devSsr.js +32 -32
- package/dist/node/devSsr.js.map +1 -1
- package/dist/node/dynamicRoutes.d.ts +2 -2
- package/dist/node/dynamicRoutes.d.ts.map +1 -1
- package/dist/node/dynamicRoutes.js +24 -24
- package/dist/node/dynamicRoutes.js.map +1 -1
- package/dist/node/favicon.d.ts +2 -2
- package/dist/node/favicon.d.ts.map +1 -1
- package/dist/node/favicon.js +26 -24
- package/dist/node/favicon.js.map +1 -1
- package/dist/node/feed.d.ts +2 -2
- package/dist/node/feed.d.ts.map +1 -1
- package/dist/node/feed.js +18 -16
- package/dist/node/feed.js.map +1 -1
- package/dist/node/hooks.d.ts +2 -2
- package/dist/node/hooks.d.ts.map +1 -1
- package/dist/node/hooks.js +1 -1
- package/dist/node/hooks.js.map +1 -1
- package/dist/node/html.d.ts +8 -8
- package/dist/node/html.d.ts.map +1 -1
- package/dist/node/html.js +75 -64
- package/dist/node/html.js.map +1 -1
- package/dist/node/index.d.ts +11 -11
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +8 -8
- package/dist/node/index.js.map +1 -1
- package/dist/node/init.d.ts +2 -0
- package/dist/node/init.d.ts.map +1 -1
- package/dist/node/init.js +59 -27
- package/dist/node/init.js.map +1 -1
- package/dist/node/lastUpdated.d.ts +2 -2
- package/dist/node/lastUpdated.d.ts.map +1 -1
- package/dist/node/lastUpdated.js +7 -4
- package/dist/node/lastUpdated.js.map +1 -1
- package/dist/node/loadSiteModule.js +2 -2
- package/dist/node/loadSiteModule.js.map +1 -1
- package/dist/node/markdown.d.ts +2 -2
- package/dist/node/markdown.d.ts.map +1 -1
- package/dist/node/markdown.js +110 -110
- package/dist/node/markdown.js.map +1 -1
- package/dist/node/markdownHeadings.d.ts +1 -1
- package/dist/node/markdownHeadings.d.ts.map +1 -1
- package/dist/node/markdownHeadings.js +11 -11
- package/dist/node/markdownHeadings.js.map +1 -1
- package/dist/node/markdownInclude.d.ts.map +1 -1
- package/dist/node/markdownInclude.js +11 -11
- package/dist/node/markdownInclude.js.map +1 -1
- package/dist/node/markdownSnippets.d.ts.map +1 -1
- package/dist/node/markdownSnippets.js +34 -34
- package/dist/node/markdownSnippets.js.map +1 -1
- package/dist/node/mdx.d.ts +1 -1
- package/dist/node/mdx.d.ts.map +1 -1
- package/dist/node/mdx.js +4 -4
- package/dist/node/mdx.js.map +1 -1
- package/dist/node/packageRoot.d.ts.map +1 -1
- package/dist/node/packageRoot.js +4 -4
- package/dist/node/packageRoot.js.map +1 -1
- package/dist/node/pageDataLoaders.d.ts +2 -2
- package/dist/node/pageDataLoaders.d.ts.map +1 -1
- package/dist/node/pageDataLoaders.js +24 -20
- package/dist/node/pageDataLoaders.js.map +1 -1
- package/dist/node/paths.d.ts.map +1 -1
- package/dist/node/paths.js +4 -4
- package/dist/node/paths.js.map +1 -1
- package/dist/node/plugin.d.ts +3 -3
- package/dist/node/plugin.d.ts.map +1 -1
- package/dist/node/plugin.js +66 -66
- package/dist/node/plugin.js.map +1 -1
- package/dist/node/resolveDeps.js +10 -10
- package/dist/node/resolveDeps.js.map +1 -1
- package/dist/node/serve.d.ts.map +1 -1
- package/dist/node/serve.js +13 -15
- package/dist/node/serve.js.map +1 -1
- package/dist/node/server.d.ts +3 -3
- package/dist/node/server.d.ts.map +1 -1
- package/dist/node/server.js +28 -25
- package/dist/node/server.js.map +1 -1
- package/dist/node/siteConfig.d.ts +12 -12
- package/dist/node/siteConfig.d.ts.map +1 -1
- package/dist/node/tagIndex.d.ts +5 -5
- package/dist/node/tagIndex.d.ts.map +1 -1
- package/dist/node/tagIndex.js +10 -10
- package/dist/node/tagIndex.js.map +1 -1
- package/dist/shared/contentChunk.d.ts.map +1 -1
- package/dist/shared/contentChunk.js +6 -6
- package/dist/shared/contentChunk.js.map +1 -1
- package/dist/shared/contentSchema.d.ts.map +1 -1
- package/dist/shared/contentSchema.js +11 -11
- package/dist/shared/contentSchema.js.map +1 -1
- package/dist/shared/deadLinks.d.ts.map +1 -1
- package/dist/shared/deadLinks.js +6 -6
- package/dist/shared/deadLinks.js.map +1 -1
- package/dist/shared/escapeHtml.js +4 -4
- package/dist/shared/escapeHtml.js.map +1 -1
- package/dist/shared/index.d.ts +14 -14
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +14 -14
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/locale.d.ts +1 -1
- package/dist/shared/locale.d.ts.map +1 -1
- package/dist/shared/locale.js +10 -10
- package/dist/shared/locale.js.map +1 -1
- package/dist/shared/pageChrome.d.ts +4 -4
- package/dist/shared/pageChrome.d.ts.map +1 -1
- package/dist/shared/pageChrome.js +21 -21
- package/dist/shared/pageChrome.js.map +1 -1
- package/dist/shared/pageHead.d.ts +1 -1
- package/dist/shared/pageHead.d.ts.map +1 -1
- package/dist/shared/pageHead.js +4 -4
- package/dist/shared/pageHead.js.map +1 -1
- package/dist/shared/pageMeta.d.ts +5 -5
- package/dist/shared/pageMeta.d.ts.map +1 -1
- package/dist/shared/pageMeta.js +15 -17
- package/dist/shared/pageMeta.js.map +1 -1
- package/dist/shared/rewrites.d.ts +1 -1
- package/dist/shared/rewrites.d.ts.map +1 -1
- package/dist/shared/rewrites.js +2 -2
- package/dist/shared/rewrites.js.map +1 -1
- package/dist/shared/route.js +5 -5
- package/dist/shared/route.js.map +1 -1
- package/dist/shared/scrollRestoration.d.ts +10 -0
- package/dist/shared/scrollRestoration.d.ts.map +1 -0
- package/dist/shared/scrollRestoration.js +66 -0
- package/dist/shared/scrollRestoration.js.map +1 -0
- package/dist/shared/search.d.ts +3 -3
- package/dist/shared/search.d.ts.map +1 -1
- package/dist/shared/search.js +18 -15
- package/dist/shared/search.js.map +1 -1
- package/dist/shared/sidebar.d.ts +1 -1
- package/dist/shared/sidebar.d.ts.map +1 -1
- package/dist/shared/sidebar.js +4 -4
- package/dist/shared/sidebar.js.map +1 -1
- package/dist/shared/slug.d.ts +1 -1
- package/dist/shared/slug.d.ts.map +1 -1
- package/dist/shared/slug.js +5 -5
- package/dist/shared/slug.js.map +1 -1
- package/dist/shared/socialIcons.d.ts.map +1 -1
- package/dist/shared/socialIcons.js +4 -4
- package/dist/shared/socialIcons.js.map +1 -1
- package/dist/shared/tags.js +8 -8
- package/dist/shared/tags.js.map +1 -1
- package/dist/shared/theme.d.ts +1 -1
- package/dist/shared/theme.d.ts.map +1 -1
- package/dist/shared/theme.js +16 -10
- package/dist/shared/theme.js.map +1 -1
- package/dist/shared/themeLabels.d.ts +1 -1
- package/dist/shared/themeLabels.d.ts.map +1 -1
- package/dist/shared/themeLabels.js +26 -26
- package/dist/shared/themeLabels.js.map +1 -1
- package/dist/shared/url.d.ts.map +1 -1
- package/dist/shared/url.js +3 -3
- package/dist/shared/url.js.map +1 -1
- package/package.json +33 -9
- package/src/client/app.tsx +111 -92
- package/src/client/entry-client.tsx +17 -19
- package/src/client/entry-ssr.tsx +33 -33
- package/src/client/index.ts +16 -2
- package/src/client/loadPage.ts +41 -38
- package/src/client/prefetchLinks.ts +30 -30
- package/src/client/theme-default/AlgoliaSearch.tsx +46 -46
- package/src/client/theme-default/Features.tsx +27 -21
- package/src/client/theme-default/Hero.tsx +22 -18
- package/src/client/theme-default/Layout.tsx +189 -244
- package/src/client/theme-default/Logo.tsx +30 -40
- package/src/client/theme-default/NavLinks.tsx +21 -21
- package/src/client/theme-default/SidebarNav.tsx +29 -29
- package/src/client/theme-default/SocialLinks.tsx +11 -11
- package/src/client/theme-default/ThemeToggle.tsx +2 -78
- package/src/client/theme-default/index.ts +1 -1
- package/src/client/theme-default/styles.css +30 -21
- package/src/client/theme-utils.tsx +184 -0
- package/src/client/types.ts +30 -24
- package/src/client/usePageHead.ts +128 -128
- package/src/client/useSiteSearch.ts +34 -34
- package/src/client/virtual.d.ts +76 -76
- package/src/shared/contentChunk.ts +6 -6
- package/src/shared/contentSchema.ts +52 -49
- package/src/shared/deadLinks.ts +16 -16
- package/src/shared/escapeHtml.ts +5 -5
- package/src/shared/index.ts +21 -25
- package/src/shared/locale.ts +46 -46
- package/src/shared/pageChrome.ts +123 -123
- package/src/shared/pageHead.ts +16 -16
- package/src/shared/pageMeta.ts +79 -79
- package/src/shared/rewrites.ts +14 -16
- package/src/shared/route.ts +7 -7
- package/src/shared/scrollRestoration.ts +70 -0
- package/src/shared/search.ts +56 -52
- package/src/shared/sidebar.ts +28 -28
- package/src/shared/slug.ts +13 -13
- package/src/shared/socialIcons.ts +12 -14
- package/src/shared/tags.ts +20 -20
- package/src/shared/theme.ts +22 -13
- package/src/shared/themeLabels.ts +45 -45
- package/src/shared/url.ts +6 -10
- package/templates/default/.preactpress/config.ts +17 -17
- package/templates/default/README.md +16 -16
- package/templates/default/guide/first-five-minutes.md +21 -21
- package/templates/default/index.html +1 -1
- package/templates/default/index.md +9 -9
- package/templates/default/package.json +1 -1
- package/templates/default/pnpm-lock.yaml +5 -5
- package/templates/docs/.preactpress/config.ts +76 -56
- package/templates/docs/README.md +6 -6
- package/templates/docs/components/BenefitsGrid.tsx +45 -0
- package/templates/docs/components/CliBlock.tsx +38 -0
- package/templates/docs/components/ComparisonTable.tsx +60 -0
- package/templates/docs/components/CopyableCommand.tsx +86 -0
- package/templates/docs/components/Counter.tsx +7 -5
- package/templates/docs/components/MarketingHero.tsx +63 -0
- package/templates/docs/components/MdxDemo.tsx +96 -0
- package/templates/docs/components/References.tsx +62 -0
- package/templates/docs/components/TemplateGallery.tsx +46 -0
- package/templates/docs/components/marketing.css +992 -0
- package/templates/docs/examples/algolia-docsearch.md +33 -0
- package/templates/docs/examples/content-loader.data.ts +11 -0
- package/templates/docs/examples/content-loader.md +29 -0
- package/templates/docs/examples/dynamic-routes.md +16 -0
- package/templates/docs/examples/static-assets.md +13 -0
- package/templates/docs/guide/advanced.md +4 -4
- package/templates/docs/guide/commands.md +10 -10
- package/templates/docs/guide/configuration.md +43 -43
- package/templates/docs/guide/creating-pages.md +60 -39
- package/templates/docs/guide/custom-themes.md +9 -9
- package/templates/docs/guide/deploy.md +29 -29
- package/templates/docs/guide/first-five-minutes.md +22 -22
- package/templates/docs/guide/getting-started.md +29 -31
- package/templates/docs/guide/markdown-and-mdx.md +1 -1
- package/templates/docs/guide/routing.md +40 -40
- package/templates/docs/guide/what-is-preactpress.md +18 -18
- package/templates/docs/index.html +1 -1
- package/templates/docs/index.mdx +25 -0
- package/templates/docs/interactive.mdx +1 -1
- package/templates/docs/markdown-examples.md +73 -21
- package/templates/docs/package.json +1 -1
- package/templates/docs/packages/[pkg].md +15 -0
- package/templates/docs/packages/[pkg].paths.ts +20 -0
- package/templates/docs/parts/include-body.md +1 -0
- package/templates/docs/pnpm-lock.yaml +5 -5
- package/templates/docs/public/preactpress-example.txt +1 -0
- package/templates/docs/snippets/greet.ts +1 -1
- package/templates/hono/.preactpress/config.ts +65 -65
- package/templates/hono/.preactpress/theme/CodeSnippet.tsx +15 -15
- package/templates/hono/.preactpress/theme/FeatureGrid.tsx +7 -7
- package/templates/hono/.preactpress/theme/Hero.tsx +13 -13
- package/templates/hono/.preactpress/theme/Layout.tsx +122 -164
- package/templates/hono/.preactpress/theme/Logo.tsx +6 -6
- package/templates/hono/.preactpress/theme/ThemeToggle.tsx +3 -70
- package/templates/hono/.preactpress/theme/hono.css +31 -14
- package/templates/hono/README.md +17 -15
- package/templates/hono/components/Counter.tsx +7 -5
- package/templates/hono/de/guide/configuration.md +18 -20
- package/templates/hono/de/guide/deploy.md +29 -29
- package/templates/hono/de/guide/first-five-minutes.md +21 -21
- package/templates/hono/de/guide/getting-started.md +29 -29
- package/templates/hono/de/guide/routing.md +26 -25
- package/templates/hono/de/guide/seiten-erstellen.md +39 -39
- package/templates/hono/de/guide/what-is-preactpress.md +18 -18
- package/templates/hono/de/index.mdx +20 -17
- package/templates/hono/de/interactive.mdx +1 -1
- package/templates/hono/de/markdown-examples.md +6 -6
- package/templates/hono/de/parts/include-body.md +1 -0
- package/templates/hono/de/snippets/greet.ts +1 -1
- package/templates/hono/guide/configuration.md +25 -25
- package/templates/hono/guide/creating-pages.md +39 -39
- package/templates/hono/guide/deploy.md +29 -29
- package/templates/hono/guide/first-five-minutes.md +21 -21
- package/templates/hono/guide/getting-started.md +29 -29
- package/templates/hono/guide/routing.md +40 -40
- package/templates/hono/guide/what-is-preactpress.md +18 -18
- package/templates/hono/index.html +1 -1
- package/templates/hono/index.mdx +21 -17
- package/templates/hono/interactive.mdx +1 -1
- package/templates/hono/markdown-examples.md +6 -6
- package/templates/hono/package.json +1 -1
- package/templates/hono/parts/include-body.md +1 -0
- package/templates/hono/pnpm-lock.yaml +5 -5
- package/templates/hono/snippets/greet.ts +1 -1
- package/templates/magazine/.preactpress/config.ts +19 -19
- package/templates/magazine/.preactpress/theme/Layout.tsx +69 -172
- package/templates/magazine/.preactpress/theme/TeaserGrid.tsx +14 -14
- package/templates/magazine/.preactpress/theme/ThemeToggle.tsx +4 -70
- package/templates/magazine/.preactpress/theme/magazine.css +13 -8
- package/templates/magazine/README.md +30 -0
- package/templates/magazine/article-markets.md +2 -2
- package/templates/magazine/article-tech.mdx +10 -10
- package/templates/magazine/index.data.ts +9 -9
- package/templates/magazine/index.html +5 -1
- package/templates/magazine/index.mdx +1 -1
- package/templates/magazine/package.json +1 -1
- package/templates/magazine/pnpm-lock.yaml +2917 -0
- package/templates/docs/about.md +0 -10
- package/templates/docs/dist/404.html +0 -29
- package/templates/docs/dist/about/index.html +0 -32
- package/templates/docs/dist/assets/esm-DzlBxN5p.js +0 -110
- package/templates/docs/dist/assets/interactive-64o6YwrR.js +0 -9
- package/templates/docs/dist/assets/interactive-BedCloEw.js +0 -9
- package/templates/docs/dist/assets/main-BVLeh8GO.js +0 -1
- package/templates/docs/dist/assets/main-CreUBb3N.js +0 -1
- package/templates/docs/dist/assets/main-oodK-zZy.css +0 -2
- package/templates/docs/dist/de/guide/getting-started/index.html +0 -36
- package/templates/docs/dist/de/guide/what-is-preactpress/index.html +0 -38
- package/templates/docs/dist/de/index.html +0 -29
- package/templates/docs/dist/favicon-32.png +0 -0
- package/templates/docs/dist/favicon.png +0 -0
- package/templates/docs/dist/favicon.svg +0 -28
- package/templates/docs/dist/guide/advanced/index.html +0 -53
- package/templates/docs/dist/guide/commands/index.html +0 -89
- package/templates/docs/dist/guide/configuration/index.html +0 -196
- package/templates/docs/dist/guide/creating-pages/index.html +0 -234
- package/templates/docs/dist/guide/custom-themes/index.html +0 -52
- package/templates/docs/dist/guide/default-theme/index.html +0 -53
- package/templates/docs/dist/guide/deploy/index.html +0 -195
- package/templates/docs/dist/guide/first-five-minutes/index.html +0 -99
- package/templates/docs/dist/guide/getting-started/index.html +0 -173
- package/templates/docs/dist/guide/markdown-and-mdx/index.html +0 -59
- package/templates/docs/dist/guide/routing/index.html +0 -192
- package/templates/docs/dist/guide/what-is-preactpress/index.html +0 -141
- package/templates/docs/dist/index.html +0 -30
- package/templates/docs/dist/interactive/index.html +0 -37
- package/templates/docs/dist/markdown-examples/index.html +0 -231
- package/templates/docs/dist/preactpress-content/404.json +0 -8
- package/templates/docs/dist/preactpress-content/_index.json +0 -50
- package/templates/docs/dist/preactpress-content/about.json +0 -15
- package/templates/docs/dist/preactpress-content/de.json +0 -45
- package/templates/docs/dist/preactpress-content/de__guide__getting-started.json +0 -26
- package/templates/docs/dist/preactpress-content/de__guide__what-is-preactpress.json +0 -21
- package/templates/docs/dist/preactpress-content/guide__advanced.json +0 -46
- package/templates/docs/dist/preactpress-content/guide__commands.json +0 -26
- package/templates/docs/dist/preactpress-content/guide__configuration.json +0 -51
- package/templates/docs/dist/preactpress-content/guide__creating-pages.json +0 -71
- package/templates/docs/dist/preactpress-content/guide__custom-themes.json +0 -15
- package/templates/docs/dist/preactpress-content/guide__default-theme.json +0 -36
- package/templates/docs/dist/preactpress-content/guide__deploy.json +0 -56
- package/templates/docs/dist/preactpress-content/guide__first-five-minutes.json +0 -36
- package/templates/docs/dist/preactpress-content/guide__getting-started.json +0 -51
- package/templates/docs/dist/preactpress-content/guide__markdown-and-mdx.json +0 -31
- package/templates/docs/dist/preactpress-content/guide__routing.json +0 -71
- package/templates/docs/dist/preactpress-content/guide__what-is-preactpress.json +0 -51
- package/templates/docs/dist/preactpress-content/markdown-examples.json +0 -71
- package/templates/docs/dist/preactpress-content/tags__markdown.json +0 -16
- package/templates/docs/dist/preactpress-search.json +0 -166
- package/templates/docs/dist/preactpress-theme.js +0 -1
- package/templates/docs/dist/tags/markdown/index.html +0 -32
- package/templates/docs/index.md +0 -28
- package/templates/hono/dist/404.html +0 -29
- package/templates/hono/dist/README/index.html +0 -104
- package/templates/hono/dist/about/index.html +0 -32
- package/templates/hono/dist/assets/Counter-CCEByS-J.js +0 -1
- package/templates/hono/dist/assets/Hero--o6WMNvm.js +0 -2
- package/templates/hono/dist/assets/de-D5r6Ye70.js +0 -10
- package/templates/hono/dist/assets/hono-BXWYYdyv.js +0 -10
- package/templates/hono/dist/assets/interactive-Bxo-WBpC.js +0 -9
- package/templates/hono/dist/assets/interactive-BznI4IQ3.js +0 -9
- package/templates/hono/dist/assets/main-Bqi-VFEk.js +0 -2
- package/templates/hono/dist/assets/main-DIIN7FO0.css +0 -1
- package/templates/hono/dist/de/about/index.html +0 -32
- package/templates/hono/dist/de/guide/commands/index.html +0 -41
- package/templates/hono/dist/de/guide/configuration/index.html +0 -105
- package/templates/hono/dist/de/guide/deploy/index.html +0 -195
- package/templates/hono/dist/de/guide/first-five-minutes/index.html +0 -99
- package/templates/hono/dist/de/guide/getting-started/index.html +0 -173
- package/templates/hono/dist/de/guide/routing/index.html +0 -165
- package/templates/hono/dist/de/guide/seiten-erstellen/index.html +0 -234
- package/templates/hono/dist/de/guide/what-is-preactpress/index.html +0 -141
- package/templates/hono/dist/de/index.html +0 -30
- package/templates/hono/dist/de/interactive/index.html +0 -37
- package/templates/hono/dist/de/markdown-examples/index.html +0 -97
- package/templates/hono/dist/de/parts/include-body/index.html +0 -36
- package/templates/hono/dist/de/tags/markdown/index.html +0 -32
- package/templates/hono/dist/favicon-32.png +0 -0
- package/templates/hono/dist/favicon.png +0 -0
- package/templates/hono/dist/favicon.svg +0 -28
- package/templates/hono/dist/guide/commands/index.html +0 -41
- package/templates/hono/dist/guide/configuration/index.html +0 -158
- package/templates/hono/dist/guide/creating-pages/index.html +0 -234
- package/templates/hono/dist/guide/deploy/index.html +0 -195
- package/templates/hono/dist/guide/first-five-minutes/index.html +0 -99
- package/templates/hono/dist/guide/getting-started/index.html +0 -173
- package/templates/hono/dist/guide/routing/index.html +0 -165
- package/templates/hono/dist/guide/what-is-preactpress/index.html +0 -141
- package/templates/hono/dist/index.html +0 -30
- package/templates/hono/dist/interactive/index.html +0 -37
- package/templates/hono/dist/markdown-examples/index.html +0 -105
- package/templates/hono/dist/partials/shared-note/index.html +0 -30
- package/templates/hono/dist/parts/include-body/index.html +0 -36
- package/templates/hono/dist/preactpress-content/404.json +0 -8
- package/templates/hono/dist/preactpress-content/README.json +0 -26
- package/templates/hono/dist/preactpress-content/about.json +0 -15
- package/templates/hono/dist/preactpress-content/de__about.json +0 -15
- package/templates/hono/dist/preactpress-content/de__guide__commands.json +0 -36
- package/templates/hono/dist/preactpress-content/de__guide__configuration.json +0 -41
- package/templates/hono/dist/preactpress-content/de__guide__deploy.json +0 -56
- package/templates/hono/dist/preactpress-content/de__guide__first-five-minutes.json +0 -36
- package/templates/hono/dist/preactpress-content/de__guide__getting-started.json +0 -51
- package/templates/hono/dist/preactpress-content/de__guide__routing.json +0 -61
- package/templates/hono/dist/preactpress-content/de__guide__seiten-erstellen.json +0 -71
- package/templates/hono/dist/preactpress-content/de__guide__what-is-preactpress.json +0 -51
- package/templates/hono/dist/preactpress-content/de__markdown-examples.json +0 -131
- package/templates/hono/dist/preactpress-content/de__parts__include-body.json +0 -16
- package/templates/hono/dist/preactpress-content/de__tags__markdown.json +0 -16
- package/templates/hono/dist/preactpress-content/guide__commands.json +0 -36
- package/templates/hono/dist/preactpress-content/guide__configuration.json +0 -51
- package/templates/hono/dist/preactpress-content/guide__creating-pages.json +0 -71
- package/templates/hono/dist/preactpress-content/guide__deploy.json +0 -56
- package/templates/hono/dist/preactpress-content/guide__first-five-minutes.json +0 -36
- package/templates/hono/dist/preactpress-content/guide__getting-started.json +0 -51
- package/templates/hono/dist/preactpress-content/guide__routing.json +0 -61
- package/templates/hono/dist/preactpress-content/guide__what-is-preactpress.json +0 -51
- package/templates/hono/dist/preactpress-content/markdown-examples.json +0 -141
- package/templates/hono/dist/preactpress-content/partials__shared-note.json +0 -10
- package/templates/hono/dist/preactpress-content/parts__include-body.json +0 -16
- package/templates/hono/dist/preactpress-content/tags__markdown.json +0 -16
- package/templates/hono/dist/preactpress-search.json +0 -242
- package/templates/hono/dist/preactpress-theme.js +0 -1
- package/templates/hono/dist/tags/markdown/index.html +0 -32
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from
|
|
2
|
-
import { publicUrl } from
|
|
1
|
+
import { useEffect, useMemo, useState } from "preact/hooks";
|
|
2
|
+
import { publicUrl } from "../shared/url.js";
|
|
3
3
|
|
|
4
4
|
export interface SearchEntry {
|
|
5
|
-
route: string
|
|
6
|
-
locale?: string
|
|
7
|
-
title?: string
|
|
8
|
-
description?: string
|
|
9
|
-
excerpt?: string
|
|
10
|
-
tags?: string[]
|
|
5
|
+
route: string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
excerpt?: string;
|
|
10
|
+
tags?: string[];
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function useSiteSearch(base: string, query: string, locale?: string): SearchEntry[] {
|
|
14
|
-
const [entries, setEntries] = useState<SearchEntry[]>([])
|
|
14
|
+
const [entries, setEntries] = useState<SearchEntry[]>([]);
|
|
15
15
|
|
|
16
16
|
useEffect(() => {
|
|
17
|
-
let cancelled = false
|
|
18
|
-
fetch(publicUrl(base,
|
|
19
|
-
.then((res) => res.ok ? res.json() : [])
|
|
17
|
+
let cancelled = false;
|
|
18
|
+
fetch(publicUrl(base, "preactpress-search.json"), { credentials: "same-origin" })
|
|
19
|
+
.then((res) => (res.ok ? res.json() : []))
|
|
20
20
|
.then((data) => {
|
|
21
|
-
if (!cancelled && Array.isArray(data)) setEntries(data as SearchEntry[])
|
|
21
|
+
if (!cancelled && Array.isArray(data)) setEntries(data as SearchEntry[]);
|
|
22
22
|
})
|
|
23
23
|
.catch(() => {
|
|
24
|
-
if (!cancelled) setEntries([])
|
|
25
|
-
})
|
|
24
|
+
if (!cancelled) setEntries([]);
|
|
25
|
+
});
|
|
26
26
|
return () => {
|
|
27
|
-
cancelled = true
|
|
28
|
-
}
|
|
29
|
-
}, [base])
|
|
27
|
+
cancelled = true;
|
|
28
|
+
};
|
|
29
|
+
}, [base]);
|
|
30
30
|
|
|
31
31
|
return useMemo(() => {
|
|
32
|
-
const needle = query.trim().toLowerCase()
|
|
33
|
-
if (!needle) return []
|
|
32
|
+
const needle = query.trim().toLowerCase();
|
|
33
|
+
if (!needle) return [];
|
|
34
34
|
return entries
|
|
35
35
|
.filter((entry) => !locale || entry.locale === locale)
|
|
36
36
|
.map((entry) => ({ entry, score: scoreEntry(entry, needle) }))
|
|
37
37
|
.filter(({ score }) => score > 0)
|
|
38
38
|
.sort((a, b) => b.score - a.score)
|
|
39
39
|
.slice(0, 8)
|
|
40
|
-
.map(({ entry }) => entry)
|
|
41
|
-
}, [entries, locale, query])
|
|
40
|
+
.map(({ entry }) => entry);
|
|
41
|
+
}, [entries, locale, query]);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function scoreEntry(entry: SearchEntry, query: string): number {
|
|
45
|
-
const title = entry.title?.toLowerCase() ??
|
|
46
|
-
const tags = entry.tags?.join(
|
|
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
|
|
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
57
|
}
|
package/src/client/virtual.d.ts
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
|
|
3
|
-
declare module
|
|
3
|
+
declare module "@docsearch/css";
|
|
4
4
|
|
|
5
|
-
declare module
|
|
6
|
-
import type { ComponentType } from
|
|
5
|
+
declare module "*.mdx" {
|
|
6
|
+
import type { ComponentType } from "preact";
|
|
7
7
|
const MdxPage: ComponentType<{
|
|
8
|
-
components?: Record<string, ComponentType<Record<string, unknown
|
|
9
|
-
}
|
|
10
|
-
export default MdxPage
|
|
8
|
+
components?: Record<string, ComponentType<Record<string, unknown>>>;
|
|
9
|
+
}>;
|
|
10
|
+
export default MdxPage;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
declare module
|
|
14
|
-
import type { ComponentType } from
|
|
13
|
+
declare module "virtual:preactpress-pages" {
|
|
14
|
+
import type { ComponentType } from "preact";
|
|
15
15
|
|
|
16
16
|
export const pages: Record<
|
|
17
17
|
string,
|
|
18
18
|
| {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
31
|
| {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
47
|
export const pagesMeta: Record<
|
|
48
48
|
string,
|
|
49
49
|
{
|
|
50
|
-
kind:
|
|
51
|
-
meta: Record<string, unknown
|
|
52
|
-
title?: string
|
|
53
|
-
description?: string
|
|
54
|
-
tags?: string[]
|
|
55
|
-
image?: string
|
|
56
|
-
pageType?:
|
|
57
|
-
headings: { id: string; text: string; level: number }[]
|
|
58
|
-
relativePath?: string
|
|
59
|
-
lastUpdated?: string
|
|
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
60
|
}
|
|
61
|
-
|
|
61
|
+
>;
|
|
62
62
|
export const mdxLoaders: Record<
|
|
63
63
|
string,
|
|
64
64
|
() => Promise<{
|
|
65
65
|
default: ComponentType<{
|
|
66
|
-
components?: Record<string, ComponentType<Record<string, unknown
|
|
67
|
-
}
|
|
66
|
+
components?: Record<string, ComponentType<Record<string, unknown>>>;
|
|
67
|
+
}>;
|
|
68
68
|
}>
|
|
69
|
-
|
|
70
|
-
export const routes: string[]
|
|
69
|
+
>;
|
|
70
|
+
export const routes: string[];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
declare module
|
|
74
|
-
export const mpa: boolean
|
|
73
|
+
declare module "virtual:preactpress-site" {
|
|
74
|
+
export const mpa: boolean;
|
|
75
75
|
export const site: {
|
|
76
|
-
title: string
|
|
77
|
-
description: string
|
|
78
|
-
base: string
|
|
79
|
-
lang: string
|
|
80
|
-
url?: string
|
|
81
|
-
}
|
|
76
|
+
title: string;
|
|
77
|
+
description: string;
|
|
78
|
+
base: string;
|
|
79
|
+
lang: string;
|
|
80
|
+
url?: string;
|
|
81
|
+
};
|
|
82
82
|
export const themeConfig: {
|
|
83
|
-
logo?: import(
|
|
84
|
-
labels?: import(
|
|
85
|
-
nav?: import(
|
|
86
|
-
sidebar?: import(
|
|
87
|
-
outline?: boolean | import(
|
|
88
|
-
search?: import(
|
|
89
|
-
socialLinks?: import(
|
|
90
|
-
tags?: boolean
|
|
91
|
-
footer?: string
|
|
92
|
-
editLink?: { pattern: string; text?: string }
|
|
93
|
-
lastUpdated?: boolean
|
|
94
|
-
}
|
|
95
|
-
export const i18n: import(
|
|
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
96
|
}
|
|
97
97
|
|
|
98
|
-
declare module
|
|
99
|
-
import type { FunctionalComponent } from
|
|
100
|
-
import type { LayoutProps } from
|
|
101
|
-
const Layout: FunctionalComponent<LayoutProps
|
|
102
|
-
export default Layout
|
|
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
103
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export const CONTENT_CHUNK_DIR =
|
|
1
|
+
export const CONTENT_CHUNK_DIR = "preactpress-content";
|
|
2
2
|
|
|
3
3
|
export function encodeContentRoute(route: string): string {
|
|
4
|
-
if (route ===
|
|
5
|
-
const clean = route.replace(/^\/+|\/+$/g,
|
|
4
|
+
if (route === "/") return "_index.json";
|
|
5
|
+
const clean = route.replace(/^\/+|\/+$/g, "");
|
|
6
6
|
return `${clean
|
|
7
|
-
.split(
|
|
7
|
+
.split("/")
|
|
8
8
|
.map((part) => encodeURIComponent(part))
|
|
9
|
-
.join(
|
|
9
|
+
.join("__")}.json`;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function contentChunkPath(route: string): string {
|
|
13
|
-
return `${CONTENT_CHUNK_DIR}/${encodeContentRoute(route)}
|
|
13
|
+
return `${CONTENT_CHUNK_DIR}/${encodeContentRoute(route)}`;
|
|
14
14
|
}
|
|
@@ -1,77 +1,79 @@
|
|
|
1
1
|
/** Author metadata for articles, magazines, and blogs. */
|
|
2
2
|
export interface Author {
|
|
3
|
-
name: string
|
|
4
|
-
slug?: string
|
|
5
|
-
avatar?: string
|
|
3
|
+
name: string;
|
|
4
|
+
slug?: string;
|
|
5
|
+
avatar?: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/** Category or rubric metadata for editorial content. */
|
|
9
9
|
export interface ContentCategory {
|
|
10
|
-
name: string
|
|
11
|
-
slug?: string
|
|
10
|
+
name: string;
|
|
11
|
+
slug?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/** Common article frontmatter fields beyond built-in page metadata. */
|
|
15
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
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
tags?: string[];
|
|
19
|
+
author?: string | Author;
|
|
20
|
+
category?: string | ContentCategory;
|
|
21
|
+
readTime?: string;
|
|
22
|
+
draft?: boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/** Normalized article record produced from content loaders or hooks. */
|
|
26
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
|
|
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
35
|
}
|
|
36
36
|
|
|
37
37
|
export function parseAuthor(value: unknown): Author | undefined {
|
|
38
|
-
if (typeof value ===
|
|
39
|
-
return { name: value.trim() }
|
|
38
|
+
if (typeof value === "string" && value.trim()) {
|
|
39
|
+
return { name: value.trim() };
|
|
40
40
|
}
|
|
41
|
-
if (!value || typeof value !==
|
|
42
|
-
const record = value as Record<string, unknown
|
|
43
|
-
const name = typeof record.name ===
|
|
44
|
-
if (!name) return undefined
|
|
45
|
-
const slug =
|
|
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 =
|
|
46
|
+
typeof record.slug === "string" && record.slug.trim() ? record.slug.trim() : undefined;
|
|
46
47
|
const avatar =
|
|
47
|
-
typeof record.avatar ===
|
|
48
|
-
return { name, slug, avatar }
|
|
48
|
+
typeof record.avatar === "string" && record.avatar.trim() ? record.avatar.trim() : undefined;
|
|
49
|
+
return { name, slug, avatar };
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export function parseCategory(value: unknown): ContentCategory | undefined {
|
|
52
|
-
if (typeof value ===
|
|
53
|
-
return { name: value.trim() }
|
|
53
|
+
if (typeof value === "string" && value.trim()) {
|
|
54
|
+
return { name: value.trim() };
|
|
54
55
|
}
|
|
55
|
-
if (!value || typeof value !==
|
|
56
|
-
const record = value as Record<string, unknown
|
|
57
|
-
const name = typeof record.name ===
|
|
58
|
-
if (!name) return undefined
|
|
59
|
-
const slug =
|
|
60
|
-
|
|
56
|
+
if (!value || typeof value !== "object") return undefined;
|
|
57
|
+
const record = value as Record<string, unknown>;
|
|
58
|
+
const name = typeof record.name === "string" ? record.name.trim() : "";
|
|
59
|
+
if (!name) return undefined;
|
|
60
|
+
const slug =
|
|
61
|
+
typeof record.slug === "string" && record.slug.trim() ? record.slug.trim() : undefined;
|
|
62
|
+
return { name, slug };
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export function articleFromFrontmatter(opts: {
|
|
64
|
-
route: string
|
|
65
|
-
url: string
|
|
66
|
-
title?: string
|
|
67
|
-
description?: string
|
|
68
|
-
tags?: string[]
|
|
69
|
-
frontmatter: Record<string, unknown
|
|
66
|
+
route: string;
|
|
67
|
+
url: string;
|
|
68
|
+
title?: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
tags?: string[];
|
|
71
|
+
frontmatter: Record<string, unknown>;
|
|
70
72
|
}): ArticlePost {
|
|
71
|
-
const fm = opts.frontmatter as ArticleFrontmatter
|
|
72
|
-
const title = (opts.title ?? fm.title ??
|
|
73
|
-
const description = (opts.description ?? fm.description)?.trim() || undefined
|
|
74
|
-
const tags = (opts.tags ?? fm.tags)?.filter((tag) => tag.trim()).map((tag) => tag.trim())
|
|
73
|
+
const fm = opts.frontmatter as ArticleFrontmatter;
|
|
74
|
+
const title = (opts.title ?? fm.title ?? "Untitled").trim();
|
|
75
|
+
const description = (opts.description ?? fm.description)?.trim() || undefined;
|
|
76
|
+
const tags = (opts.tags ?? fm.tags)?.filter((tag) => tag.trim()).map((tag) => tag.trim());
|
|
75
77
|
return {
|
|
76
78
|
title,
|
|
77
79
|
route: opts.route,
|
|
@@ -80,6 +82,7 @@ export function articleFromFrontmatter(opts: {
|
|
|
80
82
|
tags,
|
|
81
83
|
author: parseAuthor(fm.author),
|
|
82
84
|
category: parseCategory(fm.category) ?? (tags?.[0] ? { name: tags[0] } : undefined),
|
|
83
|
-
readTime:
|
|
84
|
-
|
|
85
|
+
readTime:
|
|
86
|
+
typeof fm.readTime === "string" && fm.readTime.trim() ? fm.readTime.trim() : undefined,
|
|
87
|
+
};
|
|
85
88
|
}
|
package/src/shared/deadLinks.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
export type IgnoreDeadLinks =
|
|
2
2
|
| boolean
|
|
3
3
|
| string[]
|
|
4
|
-
| ((href: string, ctx: { from: string; route?: string }) => boolean)
|
|
4
|
+
| ((href: string, ctx: { from: string; route?: string }) => boolean);
|
|
5
5
|
|
|
6
6
|
function patternToRegExp(pattern: string): RegExp {
|
|
7
7
|
const escaped = pattern
|
|
8
|
-
.replace(/[.+?^${}()|[\]\\]/g,
|
|
9
|
-
.replace(/\*\*/g,
|
|
10
|
-
.replace(/\*/g,
|
|
11
|
-
.replace(/§§/g,
|
|
12
|
-
return new RegExp(`^${escaped}$`)
|
|
8
|
+
.replace(/[.+?^${}()|[\]\\]/g, "\\$&")
|
|
9
|
+
.replace(/\*\*/g, "§§")
|
|
10
|
+
.replace(/\*/g, "[^/]*")
|
|
11
|
+
.replace(/§§/g, ".*");
|
|
12
|
+
return new RegExp(`^${escaped}$`);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
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)
|
|
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
20
|
}
|
|
21
|
-
return href.includes(pattern) || (route ? route.includes(pattern) : false)
|
|
21
|
+
return href.includes(pattern) || (route ? route.includes(pattern) : false);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function shouldIgnoreDeadLink(
|
|
25
25
|
href: string,
|
|
26
26
|
ignore: IgnoreDeadLinks | undefined,
|
|
27
|
-
ctx: { from: string; route?: string }
|
|
27
|
+
ctx: { from: string; route?: string },
|
|
28
28
|
): boolean {
|
|
29
|
-
if (!ignore) return false
|
|
30
|
-
if (ignore === true) return true
|
|
31
|
-
if (typeof ignore ===
|
|
32
|
-
return ignore.some((pattern) => matchesPattern(pattern, href, ctx.route))
|
|
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
33
|
}
|
package/src/shared/escapeHtml.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export function escapeHtml(s: string): string {
|
|
2
2
|
return s
|
|
3
|
-
.replaceAll(
|
|
4
|
-
.replaceAll(
|
|
5
|
-
.replaceAll(
|
|
6
|
-
.replaceAll('"',
|
|
3
|
+
.replaceAll("&", "&")
|
|
4
|
+
.replaceAll("<", "<")
|
|
5
|
+
.replaceAll(">", ">")
|
|
6
|
+
.replaceAll('"', """);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function escapeAttr(s: string): string {
|
|
10
|
-
return escapeHtml(s)
|
|
10
|
+
return escapeHtml(s);
|
|
11
11
|
}
|
package/src/shared/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { contentChunkPath, encodeContentRoute } from
|
|
2
|
-
export { escapeAttr, escapeHtml } from
|
|
1
|
+
export { contentChunkPath, encodeContentRoute } from "./contentChunk.js";
|
|
2
|
+
export { escapeAttr, escapeHtml } from "./escapeHtml.js";
|
|
3
3
|
export {
|
|
4
4
|
PAGE_LAYOUTS,
|
|
5
5
|
DEFAULT_TITLE_TEMPLATE,
|
|
@@ -12,8 +12,8 @@ export {
|
|
|
12
12
|
titleTemplateFromMeta,
|
|
13
13
|
type PageFrontmatter,
|
|
14
14
|
type PageLayout,
|
|
15
|
-
type PageMetaInput
|
|
16
|
-
} from
|
|
15
|
+
type PageMetaInput,
|
|
16
|
+
} from "./pageMeta.js";
|
|
17
17
|
export {
|
|
18
18
|
articleFromFrontmatter,
|
|
19
19
|
parseAuthor,
|
|
@@ -21,9 +21,9 @@ export {
|
|
|
21
21
|
type ArticleFrontmatter,
|
|
22
22
|
type ArticlePost,
|
|
23
23
|
type Author,
|
|
24
|
-
type ContentCategory
|
|
25
|
-
} from
|
|
26
|
-
export { headTagsFromMeta } from
|
|
24
|
+
type ContentCategory,
|
|
25
|
+
} from "./contentSchema.js";
|
|
26
|
+
export { headTagsFromMeta } from "./pageHead.js";
|
|
27
27
|
export {
|
|
28
28
|
allSidebarGroups,
|
|
29
29
|
flattenNavLeafItems,
|
|
@@ -31,18 +31,14 @@ export {
|
|
|
31
31
|
flattenSidebarLeafItems,
|
|
32
32
|
isPathSidebarConfig,
|
|
33
33
|
resolveSidebarForRoute,
|
|
34
|
-
type SidebarConfig
|
|
35
|
-
} from
|
|
36
|
-
export {
|
|
37
|
-
applyRouteRewrites,
|
|
38
|
-
normalizeRewriteRoute,
|
|
39
|
-
type RouteRewrites
|
|
40
|
-
} from './rewrites.js'
|
|
34
|
+
type SidebarConfig,
|
|
35
|
+
} from "./sidebar.js";
|
|
36
|
+
export { applyRouteRewrites, normalizeRewriteRoute, type RouteRewrites } from "./rewrites.js";
|
|
41
37
|
export {
|
|
42
38
|
defaultLabelsForLang,
|
|
43
39
|
resolveThemeLabels,
|
|
44
|
-
type ResolvedThemeLabels
|
|
45
|
-
} from
|
|
40
|
+
type ResolvedThemeLabels,
|
|
41
|
+
} from "./themeLabels.js";
|
|
46
42
|
export {
|
|
47
43
|
filterHeadingsForOutline,
|
|
48
44
|
parseFeatures,
|
|
@@ -56,8 +52,8 @@ export {
|
|
|
56
52
|
type PageOutlineConfig,
|
|
57
53
|
type PageOutlineLevels,
|
|
58
54
|
type ResolvedPageChrome,
|
|
59
|
-
type ThemeableImage
|
|
60
|
-
} from
|
|
55
|
+
type ThemeableImage,
|
|
56
|
+
} from "./pageChrome.js";
|
|
61
57
|
export {
|
|
62
58
|
algoliaOptionsFromSearch,
|
|
63
59
|
getRelativeDocSearchUrl,
|
|
@@ -70,14 +66,14 @@ export {
|
|
|
70
66
|
type AlgoliaSearchOptions,
|
|
71
67
|
type LocalSearchConfig,
|
|
72
68
|
type SearchConfig,
|
|
73
|
-
type SearchProvider
|
|
74
|
-
} from
|
|
69
|
+
type SearchProvider,
|
|
70
|
+
} from "./search.js";
|
|
75
71
|
export {
|
|
76
72
|
socialIconSvg,
|
|
77
73
|
socialLinkLabel,
|
|
78
74
|
type SocialLink,
|
|
79
|
-
type SocialLinkIcon
|
|
80
|
-
} from
|
|
81
|
-
export { normalizeRoute, routeFromPathname } from
|
|
82
|
-
export { slugifySegment, uniqueSlug } from
|
|
83
|
-
export { slugifyTagSegment, tagIndexPageRoute } from
|
|
75
|
+
type SocialLinkIcon,
|
|
76
|
+
} from "./socialIcons.js";
|
|
77
|
+
export { normalizeRoute, routeFromPathname } from "./route.js";
|
|
78
|
+
export { slugifySegment, uniqueSlug } from "./slug.js";
|
|
79
|
+
export { slugifyTagSegment, tagIndexPageRoute } from "./tags.js";
|