diff --git a/astro.config.mjs b/astro.config.mjs index d7d187a4..21649af2 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -4,6 +4,17 @@ import solidJs from "@astrojs/solid-js"; import react from "@astrojs/react"; import starlightLinksValidator from 'starlight-links-validator'; import sitemap from "@astrojs/sitemap"; +import starlightDocSearch from '@astrojs/starlight-docsearch'; +import { loadEnv } from "vite"; + +const { DOCSEARCH_API_ID } = loadEnv(process.env.DOCSEARCH_API_ID, process.cwd(), ""); +const { DOCSEARCH_API_SEARCH_KEY } = loadEnv(process.env.DOCSEARCH_API_SERACH_KEY, process.cwd(), ""); +const { DOCSEARCH_INDEX_NAME } = loadEnv(process.env.DOCSEARCH_INDEX_NAME, process.cwd(), ""); + +if (!DOCSEARCH_API_ID || !DOCSEARCH_API_SEARCH_KEY || !DOCSEARCH_INDEX_NAME){ + console.error("Algolia DocSearch enviroment variables are invalid. Please check configuration!"); + process.exit(1); +} // https://astro.build/config export default defineConfig({ @@ -19,6 +30,11 @@ export default defineConfig({ starlightLinksValidator({ errorOnRelativeLinks: true, }), + starlightDocSearch({ + appId: DOCSEARCH_API_ID, + apiKey: DOCSEARCH_API_SERACH_KEY, + indexName: DOCSEARCH_INDEX_NAME, + }), ], expressiveCode: { // theme: ["github-dark", "github-light"], diff --git a/package-lock.json b/package-lock.json index 8a694b86..75a33ce2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@astrojs/sitemap": "^3.1.6", "@astrojs/solid-js": "^4.4.0", "@astrojs/starlight": "^0.28.2", + "@astrojs/starlight-docsearch": "^0.3.0", "@mdx-js/mdx": "3.0.1", "@types/react": "18.3.2", "@types/react-dom": "18.3.0", @@ -42,6 +43,214 @@ "accessible-astro-components": "2.3.6" } }, + "node_modules/@algolia/autocomplete-core": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.17.7.tgz", + "integrity": "sha512-BjiPOW6ks90UKl7TwMv7oNQMnzU+t/wk9mgIDi6b1tXpUek7MW0lbNOUHpvam9pe3lVCf4xPFT+lK7s+e+fs7Q==", + "dependencies": { + "@algolia/autocomplete-plugin-algolia-insights": "1.17.7", + "@algolia/autocomplete-shared": "1.17.7" + } + }, + "node_modules/@algolia/autocomplete-plugin-algolia-insights": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.17.7.tgz", + "integrity": "sha512-Jca5Ude6yUOuyzjnz57og7Et3aXjbwCSDf/8onLHSQgw1qW3ALl9mrMWaXb5FmPVkV3EtkD2F/+NkT6VHyPu9A==", + "dependencies": { + "@algolia/autocomplete-shared": "1.17.7" + }, + "peerDependencies": { + "search-insights": ">= 1 < 3" + } + }, + "node_modules/@algolia/autocomplete-preset-algolia": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.17.7.tgz", + "integrity": "sha512-ggOQ950+nwbWROq2MOCIL71RE0DdQZsceqrg32UqnhDz8FlO9rL8ONHNsI2R1MH0tkgVIDKI/D0sMiUchsFdWA==", + "dependencies": { + "@algolia/autocomplete-shared": "1.17.7" + }, + "peerDependencies": { + "@algolia/client-search": ">= 4.9.1 < 6", + "algoliasearch": ">= 4.9.1 < 6" + } + }, + "node_modules/@algolia/autocomplete-shared": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.17.7.tgz", + "integrity": "sha512-o/1Vurr42U/qskRSuhBH+VKxMvkkUVTLU6WZQr+L5lGZZLYWyhdzWjW0iGXY7EkwRTjBqvN2EsR81yCTGV/kmg==", + "peerDependencies": { + "@algolia/client-search": ">= 4.9.1 < 6", + "algoliasearch": ">= 4.9.1 < 6" + } + }, + "node_modules/@algolia/client-abtesting": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.17.0.tgz", + "integrity": "sha512-6+7hPdOEPfJqjWNYPRaVcttLLAtVqQyp1U7xBA1e1uSya1ivIr9FtS/GBr31mfvwk2N2yxV4W7itxuBtST8SWg==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-analytics": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.17.0.tgz", + "integrity": "sha512-nhJ+elL8h0Fts3xD9261zE2NvTs7nPMe9/SfAgMnWnbvxmuhJn7ZymnBsfm2VkTDb4Dy810ZAdBfzYEk7PjlAw==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-common": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.17.0.tgz", + "integrity": "sha512-9eC8i41/4xcQ/wI6fVM4LwC/ZGcDl3mToqjM0wTZzePWhXgRrdzOzqy/XgP+L1yYCDfkMFBZZsruNL5U8aEOag==", + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-insights": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.17.0.tgz", + "integrity": "sha512-JL/vWNPUIuScsJubyC4aPHkpMftlK2qGqMiR2gy0rGvrh8v0w+ec6Ebq+efoFgE8wO55HJPTxiKeerE1DaQgvA==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-personalization": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.17.0.tgz", + "integrity": "sha512-PkMUfww8QiRpyLkW4kzmc7IJDcW90sfUpnTgUOVlug5zEE2iv1ruHrJxdcNRTXkA0fgVpHu3oxXmCQL/ie2p7A==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-query-suggestions": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.17.0.tgz", + "integrity": "sha512-bokfgPN2whetLuiX9NB6C6d7Eke+dvHuASOPiB+jdI8Z6hacLHkcJjYeZY4Mppj0/oJ1KlyNivj+8WNpZeGhYA==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-search": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.17.0.tgz", + "integrity": "sha512-alY3U79fiEvlR/0optgt1LZp9MfthXFnuEA4GYS81svozDOF61gdvxgBjt6SYtmskmTQQZDWVgakvUvvHrDzMw==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/ingestion": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.17.0.tgz", + "integrity": "sha512-9+mO+FbIpWz6izh1lXzON9BcenBKx4K3qVjSWiFFmL8nv+7b7zpGq++LXWr/Lxv/bZ9+D71Go6QVL6AZQhFOmg==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/monitoring": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.17.0.tgz", + "integrity": "sha512-Db7Qh51zVchmHa8d9nQFzTz2Ta6H2D4dpCnPj1giC/LE6UG/6e3iOnRxUzV+9ZR7etHKIrri2hbnkyNrvbqA9A==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/recommend": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.17.0.tgz", + "integrity": "sha512-7vM4+mfuLYbslj8+RNsP/ISwY7izu5HcQqQhA0l+q3EZRHF+PBeRaJXc3S1N0fTRxj8ystvwXWZPmjssB/xMLw==", + "dependencies": { + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/requester-browser-xhr": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.17.0.tgz", + "integrity": "sha512-bXSiPL2R08s4e9qvNZsJA0bXZeyWH2A5D4shS8kRT22b8GgjtnGTuoZmi6MxtKOEaN0lpHPbjvjXAO7UIOhDog==", + "dependencies": { + "@algolia/client-common": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/requester-fetch": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.17.0.tgz", + "integrity": "sha512-mjJ6Xv7TlDDoZ6RLKrEzH1ved3g2GAq3YJjb94bA639INfxK1HM8A/wCAFSZ8ye+QM/jppwauDXe1PENkuareQ==", + "dependencies": { + "@algolia/client-common": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/requester-node-http": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.17.0.tgz", + "integrity": "sha512-Z2BXTR7BctlGPNig21k2wf/5nlH+96lU2UElzXTKiptyn2iM8lDU8zdO+dRll0AxQUxUGWEnkBysst9xL3S2cg==", + "dependencies": { + "@algolia/client-common": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -304,6 +513,18 @@ "astro": "^4.14.0" } }, + "node_modules/@astrojs/starlight-docsearch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@astrojs/starlight-docsearch/-/starlight-docsearch-0.3.0.tgz", + "integrity": "sha512-GA8bSuXb0cX4U0Ic+9iUpd+lB1V+qgJbqXwJ6gQTC1wowX0KXrFiBaWzrfe4xJJYtPFuEe+hl09WdlNpdPH98w==", + "dependencies": { + "@docsearch/css": "^3.6.0", + "@docsearch/js": "^3.6.0" + }, + "peerDependencies": { + "@astrojs/starlight": ">=0.28.0" + } + }, "node_modules/@astrojs/starlight/node_modules/astro-expressive-code": { "version": "0.35.6", "resolved": "https://registry.npmjs.org/astro-expressive-code/-/astro-expressive-code-0.35.6.tgz", @@ -677,6 +898,51 @@ "node": ">=14" } }, + "node_modules/@docsearch/css": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.8.0.tgz", + "integrity": "sha512-pieeipSOW4sQ0+bE5UFC51AOZp9NGxg89wAlZ1BAQFaiRAGK1IKUaPQ0UGZeNctJXyqZ1UvBtOQh2HH+U5GtmA==" + }, + "node_modules/@docsearch/js": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.8.0.tgz", + "integrity": "sha512-PVuV629f5UcYRtBWqK7ID6vNL5647+2ADJypwTjfeBIrJfwPuHtzLy39hMGMfFK+0xgRyhTR0FZ83EkdEraBlg==", + "dependencies": { + "@docsearch/react": "3.8.0", + "preact": "^10.0.0" + } + }, + "node_modules/@docsearch/react": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.8.0.tgz", + "integrity": "sha512-WnFK720+iwTVt94CxY3u+FgX6exb3BfN5kE9xUY6uuAH/9W/UFboBZFLlrw/zxFRHoHZCOXRtOylsXF+6LHI+Q==", + "dependencies": { + "@algolia/autocomplete-core": "1.17.7", + "@algolia/autocomplete-preset-algolia": "1.17.7", + "@docsearch/css": "3.8.0", + "algoliasearch": "^5.12.0" + }, + "peerDependencies": { + "@types/react": ">= 16.8.0 < 19.0.0", + "react": ">= 16.8.0 < 19.0.0", + "react-dom": ">= 16.8.0 < 19.0.0", + "search-insights": ">= 1 < 3" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "search-insights": { + "optional": true + } + } + }, "node_modules/@emnapi/runtime": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz", @@ -2287,6 +2553,29 @@ "node": ">= 6.0.0" } }, + "node_modules/algoliasearch": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.17.0.tgz", + "integrity": "sha512-BpuFprDFc3Pe9a1ZXLzLeqZ+l8Ur37AfzBswkOB4LwikqnRPbIGdluT/nFc/Xk+u/QMxMzUlTN+izqQJVb5vYA==", + "dependencies": { + "@algolia/client-abtesting": "5.17.0", + "@algolia/client-analytics": "5.17.0", + "@algolia/client-common": "5.17.0", + "@algolia/client-insights": "5.17.0", + "@algolia/client-personalization": "5.17.0", + "@algolia/client-query-suggestions": "5.17.0", + "@algolia/client-search": "5.17.0", + "@algolia/ingestion": "1.17.0", + "@algolia/monitoring": "1.17.0", + "@algolia/recommend": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, "node_modules/ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", @@ -7139,6 +7428,15 @@ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, + "node_modules/preact": { + "version": "10.25.1", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.25.1.tgz", + "integrity": "sha512-frxeZV2vhQSohQwJ7FvlqC40ze89+8friponWUFeVEkaCfhC6Eu4V0iND5C9CXz8JLndV07QRDeXzH1+Anz5Og==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, "node_modules/preferred-pm": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-4.0.0.tgz", @@ -7727,6 +8025,12 @@ "loose-envify": "^1.1.0" } }, + "node_modules/search-insights": { + "version": "2.17.3", + "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.17.3.tgz", + "integrity": "sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==", + "peer": true + }, "node_modules/section-matter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", diff --git a/package.json b/package.json index ae960a2a..365684dc 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@astrojs/sitemap": "^3.1.6", "@astrojs/solid-js": "^4.4.0", "@astrojs/starlight": "^0.28.2", + "@astrojs/starlight-docsearch": "^0.3.0", "@mdx-js/mdx": "3.0.1", "@types/react": "18.3.2", "@types/react-dom": "18.3.0",