diff --git a/__tests__/e2e/.vitepress/config.ts b/__tests__/e2e/.vitepress/config.ts index 9a40532f..293e4587 100644 --- a/__tests__/e2e/.vitepress/config.ts +++ b/__tests__/e2e/.vitepress/config.ts @@ -87,6 +87,14 @@ export default defineConfig({ title: 'Example', description: 'An example app using VitePress.', themeConfig: { - sidebar + sidebar, + search: { + provider: 'local', + options: { + exclude(relativePath) { + return relativePath.startsWith('local-search/excluded') + } + } + } } }) diff --git a/__tests__/e2e/local-search/excluded.md b/__tests__/e2e/local-search/excluded.md new file mode 100644 index 00000000..eb9e7c01 --- /dev/null +++ b/__tests__/e2e/local-search/excluded.md @@ -0,0 +1 @@ +# Local search config excluded \ No newline at end of file diff --git a/__tests__/e2e/local-search/frontmatter-excluded.md b/__tests__/e2e/local-search/frontmatter-excluded.md new file mode 100644 index 00000000..afc32512 --- /dev/null +++ b/__tests__/e2e/local-search/frontmatter-excluded.md @@ -0,0 +1,5 @@ +--- +search: false +--- + +# Local search frontmatter excluded \ No newline at end of file diff --git a/__tests__/e2e/local-search/index.md b/__tests__/e2e/local-search/index.md new file mode 100644 index 00000000..08d8b31a --- /dev/null +++ b/__tests__/e2e/local-search/index.md @@ -0,0 +1 @@ +# Local search included \ No newline at end of file diff --git a/__tests__/e2e/local-search/local-search.test.ts b/__tests__/e2e/local-search/local-search.test.ts new file mode 100644 index 00000000..bea2c6b9 --- /dev/null +++ b/__tests__/e2e/local-search/local-search.test.ts @@ -0,0 +1,34 @@ +describe('local search', () => { + beforeEach(async () => { + await goto('/') + // FIXME: remove this when optimizeDeps.include is fixed + await page.locator('#local-search button').click() + await goto('/') + }) + + test('exclude content from search results', async () => { + await page.locator('#local-search button').click() + + const input = await page.waitForSelector('input#localsearch-input') + await input.type('local') + + await page.waitForSelector('ul#localsearch-list', { state: 'visible' }) + + const searchResults = page.locator('#localsearch-list') + expect(await searchResults.locator('li[role=option]').count()).toBe(1) + + expect( + await searchResults.filter({ hasText: 'Local search included' }).count() + ).toBe(1) + + expect( + await searchResults.filter({ hasText: 'Local search excluded' }).count() + ).toBe(0) + + expect( + await searchResults + .filter({ hasText: 'Local search frontmatter excluded' }) + .count() + ).toBe(0) + }) +}) diff --git a/__tests__/e2e/package.json b/__tests__/e2e/package.json index e2870fc5..1d558ff7 100644 --- a/__tests__/e2e/package.json +++ b/__tests__/e2e/package.json @@ -5,7 +5,9 @@ "scripts": { "test": "vitest run", "watch": "DEBUG=1 vitest", - "site": "vitepress" + "site:dev": "vitepress", + "site:build": "vitepress build", + "site:preview": "vitepress preview" }, "devDependencies": { "vitepress": "workspace:*" diff --git a/docs/reference/default-theme-search.md b/docs/reference/default-theme-search.md index 168138fd..2fc852e1 100644 --- a/docs/reference/default-theme-search.md +++ b/docs/reference/default-theme-search.md @@ -98,6 +98,24 @@ export default defineConfig({ Learn more in [MiniSearch docs](https://lucaong.github.io/minisearch/classes/_minisearch_.minisearch.html). +### Excluding pages from search + +You can exclude pages from search by adding `search: false` to the frontmatter of the page. Alternatively, you can also pass `exclude` function to `themeConfig.search.options` to exclude pages based on their path relative to `srcDir`: + +```ts +import { defineConfig } from 'vitepress' + +export default defineConfig({ + themeConfig: { + search: { + options: { + exclude: (path) => path.startsWith('/some/path') + } + } + } +}) +``` + ## Algolia Search VitePress supports searching your docs site using [Algolia DocSearch](https://docsearch.algolia.com/docs/what-is-docsearch). Refer their getting started guide. In your `.vitepress/config.ts` you'll need to provide at least the following to make it work: diff --git a/package.json b/package.json index 416a096c..44d7586e 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,9 @@ "test:unit": "vitest run -r __tests__/unit", "test:unit:watch": "vitest -r __tests__/unit", "test:e2e": "run-s test:e2e-dev test:e2e-build", - "test:e2e:site": "pnpm -F=tests-e2e site", + "test:e2e:site:dev": "pnpm -F=tests-e2e site:dev", + "test:e2e:site:build": "pnpm -F=tests-e2e site:build", + "test:e2e:site:preview": "pnpm -F=tests-e2e site:preview", "test:e2e-dev": "pnpm -F=tests-e2e test", "test:e2e-dev:watch": "pnpm -F=tests-e2e watch", "test:e2e-build": "VITE_TEST_BUILD=1 pnpm test:e2e-dev", @@ -100,7 +102,7 @@ "mark.js": "8.11.1", "minisearch": "^6.1.0", "shiki": "^0.14.3", - "vite": "^4.4.4", + "vite": "^4.4.6", "vue": "^3.3.4" }, "devDependencies": { @@ -138,7 +140,7 @@ "conventional-changelog-cli": "^2", "cross-spawn": "^7.0.3", "debug": "^4.3.4", - "esbuild": "^0.18.14", + "esbuild": "^0.18.15", "escape-html": "^1.0.3", "execa": "^7.1.1", "fast-glob": "^3.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c75dbbda..65aecf72 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,10 +13,10 @@ importers: version: 3.5.1 '@docsearch/js': specifier: ^3.5.1 - version: 3.5.1(@algolia/client-search@4.19.0)(search-insights@2.7.0) + version: 3.5.1(@algolia/client-search@4.19.1)(search-insights@2.7.0) '@vitejs/plugin-vue': specifier: ^4.2.3 - version: 4.2.3(vite@4.4.4)(vue@3.3.4) + version: 4.2.3(vite@4.4.6)(vue@3.3.4) '@vue/devtools-api': specifier: ^6.5.0 version: 6.5.0 @@ -42,8 +42,8 @@ importers: specifier: ^0.14.3 version: 0.14.3 vite: - specifier: ^4.4.4 - version: 4.4.4(@types/node@20.4.2) + specifier: ^4.4.6 + version: 4.4.6(@types/node@20.4.2) vue: specifier: ^3.3.4 version: 3.3.4 @@ -151,8 +151,8 @@ importers: specifier: ^4.3.4 version: 4.3.4(supports-color@9.4.0) esbuild: - specifier: ^0.18.14 - version: 0.18.14 + specifier: ^0.18.15 + version: 0.18.15 escape-html: specifier: ^1.0.3 version: 1.0.3 @@ -245,7 +245,7 @@ importers: version: 5.3.0(rollup@3.26.3)(typescript@5.1.6) rollup-plugin-esbuild: specifier: ^5.0.0 - version: 5.0.0(esbuild@0.18.14)(rollup@3.26.3)(supports-color@9.4.0) + version: 5.0.0(esbuild@0.18.15)(rollup@3.26.3)(supports-color@9.4.0) semver: specifier: ^7.5.4 version: 7.5.4 @@ -294,138 +294,138 @@ importers: packages: - /@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0)(search-insights@2.7.0): + /@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1)(search-insights@2.7.0): resolution: {integrity: sha512-009HdfugtGCdC4JdXUbVJClA0q0zh24yyePn+KUGk3rP7j8FEe/m5Yo/z65gn6nP/cM39PxpzqKrL7A6fP6PPw==} dependencies: - '@algolia/autocomplete-plugin-algolia-insights': 1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0)(search-insights@2.7.0) - '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0) + '@algolia/autocomplete-plugin-algolia-insights': 1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1)(search-insights@2.7.0) + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1) transitivePeerDependencies: - '@algolia/client-search' - algoliasearch - search-insights dev: false - /@algolia/autocomplete-plugin-algolia-insights@1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0)(search-insights@2.7.0): + /@algolia/autocomplete-plugin-algolia-insights@1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1)(search-insights@2.7.0): resolution: {integrity: sha512-a/yTUkcO/Vyy+JffmAnTWbr4/90cLzw+CC3bRbhnULr/EM0fGNvM13oQQ14f2moLMcVDyAx/leczLlAOovhSZg==} peerDependencies: search-insights: '>= 1 < 3' dependencies: - '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0) + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1) search-insights: 2.7.0 transitivePeerDependencies: - '@algolia/client-search' - algoliasearch dev: false - /@algolia/autocomplete-preset-algolia@1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0): + /@algolia/autocomplete-preset-algolia@1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1): resolution: {integrity: sha512-d4qlt6YmrLMYy95n5TB52wtNDr6EgAIPH81dvvvW8UmuWRgxEtY0NJiPwl/h95JtG2vmRM804M0DSwMCNZlzRA==} peerDependencies: '@algolia/client-search': '>= 4.9.1 < 6' algoliasearch: '>= 4.9.1 < 6' dependencies: - '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0) - '@algolia/client-search': 4.19.0 - algoliasearch: 4.19.0 + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1) + '@algolia/client-search': 4.19.1 + algoliasearch: 4.19.1 dev: false - /@algolia/autocomplete-shared@1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0): + /@algolia/autocomplete-shared@1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1): resolution: {integrity: sha512-Wnm9E4Ye6Rl6sTTqjoymD+l8DjSTHsHboVRYrKgEt8Q7UHm9nYbqhN/i0fhUYA3OAEH7WA8x3jfpnmJm3rKvaQ==} peerDependencies: '@algolia/client-search': '>= 4.9.1 < 6' algoliasearch: '>= 4.9.1 < 6' dependencies: - '@algolia/client-search': 4.19.0 - algoliasearch: 4.19.0 + '@algolia/client-search': 4.19.1 + algoliasearch: 4.19.1 dev: false - /@algolia/cache-browser-local-storage@4.19.0: - resolution: {integrity: sha512-G2NxUr3+gFMFwrEsjy7DwZJYXIxBQC5DeRZVKVEpTxW8AkBI2Y7MF+VUs4C8qqE3lHuioym4rvDipzH1xk3DKw==} + /@algolia/cache-browser-local-storage@4.19.1: + resolution: {integrity: sha512-FYAZWcGsFTTaSAwj9Std8UML3Bu8dyWDncM7Ls8g+58UOe4XYdlgzXWbrIgjaguP63pCCbMoExKr61B+ztK3tw==} dependencies: - '@algolia/cache-common': 4.19.0 + '@algolia/cache-common': 4.19.1 dev: false - /@algolia/cache-common@4.19.0: - resolution: {integrity: sha512-4zFZCC0vYTvfoFSyAXEXDtQFamMibtMPjARirfvRlfgK+5YXW9qJIV+V7O/4qb1mH6RjngvHOo3GDE1xDoIzKA==} + /@algolia/cache-common@4.19.1: + resolution: {integrity: sha512-XGghi3l0qA38HiqdoUY+wvGyBsGvKZ6U3vTiMBT4hArhP3fOGLXpIINgMiiGjTe4FVlTa5a/7Zf2bwlIHfRqqg==} dev: false - /@algolia/cache-in-memory@4.19.0: - resolution: {integrity: sha512-Q6z2p4MaiWs4PXB4NQ5l/ZE1j54mF1xlnqOLw0TKKXBhlNM5pOl5XKSvr/t/KHfrkO1/ua/f/YW71iA/lPGn+A==} + /@algolia/cache-in-memory@4.19.1: + resolution: {integrity: sha512-+PDWL+XALGvIginigzu8oU6eWw+o76Z8zHbBovWYcrtWOEtinbl7a7UTt3x3lthv+wNuFr/YD1Gf+B+A9V8n5w==} dependencies: - '@algolia/cache-common': 4.19.0 + '@algolia/cache-common': 4.19.1 dev: false - /@algolia/client-account@4.19.0: - resolution: {integrity: sha512-/0ZASb3ErYjM9GJijaF6JDDhDiyGYwp2FQ2QInUzH0mq/+a5s1PMI3r/8NV1DmlX+p93d2QplnLpjgNTn4eafw==} + /@algolia/client-account@4.19.1: + resolution: {integrity: sha512-Oy0ritA2k7AMxQ2JwNpfaEcgXEDgeyKu0V7E7xt/ZJRdXfEpZcwp9TOg4TJHC7Ia62gIeT2Y/ynzsxccPw92GA==} dependencies: - '@algolia/client-common': 4.19.0 - '@algolia/client-search': 4.19.0 - '@algolia/transporter': 4.19.0 + '@algolia/client-common': 4.19.1 + '@algolia/client-search': 4.19.1 + '@algolia/transporter': 4.19.1 dev: false - /@algolia/client-analytics@4.19.0: - resolution: {integrity: sha512-tB9L0YJ86a1e/ibNdnbFw+yOKooQlmh95Ld6Qyj4GQ1vFmzBpd4x4ilhyFFXbOjsvNGgALu8+44gp5h2ynxrwg==} + /@algolia/client-analytics@4.19.1: + resolution: {integrity: sha512-5QCq2zmgdZLIQhHqwl55ZvKVpLM3DNWjFI4T+bHr3rGu23ew2bLO4YtyxaZeChmDb85jUdPDouDlCumGfk6wOg==} dependencies: - '@algolia/client-common': 4.19.0 - '@algolia/client-search': 4.19.0 - '@algolia/requester-common': 4.19.0 - '@algolia/transporter': 4.19.0 + '@algolia/client-common': 4.19.1 + '@algolia/client-search': 4.19.1 + '@algolia/requester-common': 4.19.1 + '@algolia/transporter': 4.19.1 dev: false - /@algolia/client-common@4.19.0: - resolution: {integrity: sha512-tiEyCKkkG5Ig04ATYlt1v41UJb/lS4RmJVXEAsaTkoyB5iUCOChE5WEVPPuJbO/5tSTCbIF4P+g5BjQDb7aGBA==} + /@algolia/client-common@4.19.1: + resolution: {integrity: sha512-3kAIVqTcPrjfS389KQvKzliC559x+BDRxtWamVJt8IVp7LGnjq+aVAXg4Xogkur1MUrScTZ59/AaUd5EdpyXgA==} dependencies: - '@algolia/requester-common': 4.19.0 - '@algolia/transporter': 4.19.0 + '@algolia/requester-common': 4.19.1 + '@algolia/transporter': 4.19.1 dev: false - /@algolia/client-personalization@4.19.0: - resolution: {integrity: sha512-nG56w0dphlStCOgB80q0ug0SHYM+tQosL4Qprc+cy8ckFhTgC3hRtyRYHYGPk9txow5pPKDtyb5rnr3oviKP1Q==} + /@algolia/client-personalization@4.19.1: + resolution: {integrity: sha512-8CWz4/H5FA+krm9HMw2HUQenizC/DxUtsI5oYC0Jxxyce1vsr8cb1aEiSJArQT6IzMynrERif1RVWLac1m36xw==} dependencies: - '@algolia/client-common': 4.19.0 - '@algolia/requester-common': 4.19.0 - '@algolia/transporter': 4.19.0 + '@algolia/client-common': 4.19.1 + '@algolia/requester-common': 4.19.1 + '@algolia/transporter': 4.19.1 dev: false - /@algolia/client-search@4.19.0: - resolution: {integrity: sha512-kkqvljLIBYFv+GMefIq0wv2cRP30NG5/INyL1OKr8Qk4Nk0FciFF3wdxIgv6fm156x1q4V0fLw5zwMMWMPOsLQ==} + /@algolia/client-search@4.19.1: + resolution: {integrity: sha512-mBecfMFS4N+yK/p0ZbK53vrZbL6OtWMk8YmnOv1i0LXx4pelY8TFhqKoTit3NPVPwoSNN0vdSN9dTu1xr1XOVw==} dependencies: - '@algolia/client-common': 4.19.0 - '@algolia/requester-common': 4.19.0 - '@algolia/transporter': 4.19.0 + '@algolia/client-common': 4.19.1 + '@algolia/requester-common': 4.19.1 + '@algolia/transporter': 4.19.1 dev: false - /@algolia/logger-common@4.19.0: - resolution: {integrity: sha512-2YdIHiQwlUCdhFFK1rE53VCEc8scTUcQLWJgpzi1amvP/ffUog4h5VXdGhyhHzYeAexMsaELX2/sEJa4lgOzng==} + /@algolia/logger-common@4.19.1: + resolution: {integrity: sha512-i6pLPZW/+/YXKis8gpmSiNk1lOmYCmRI6+x6d2Qk1OdfvX051nRVdalRbEcVTpSQX6FQAoyeaui0cUfLYW5Elw==} dev: false - /@algolia/logger-console@4.19.0: - resolution: {integrity: sha512-JjbFPW35gm1RswkB3sgIAS/TjXoqG3FR8Gvsg8lPIB2oh8mcpybyJOUcq56sAfbIQ6n0aFuG4lgqES5TqlWzXw==} + /@algolia/logger-console@4.19.1: + resolution: {integrity: sha512-jj72k9GKb9W0c7TyC3cuZtTr0CngLBLmc8trzZlXdfvQiigpUdvTi1KoWIb2ZMcRBG7Tl8hSb81zEY3zI2RlXg==} dependencies: - '@algolia/logger-common': 4.19.0 + '@algolia/logger-common': 4.19.1 dev: false - /@algolia/requester-browser-xhr@4.19.0: - resolution: {integrity: sha512-5c3FlK7ZJ6oiLuZHe0iSpPzWlHCzeunQS7nlBsB4sEecVcvRJfXOklLh2vZfouQdaT14gXJ+Hwb2SuyRQLU6Ug==} + /@algolia/requester-browser-xhr@4.19.1: + resolution: {integrity: sha512-09K/+t7lptsweRTueHnSnmPqIxbHMowejAkn9XIcJMLdseS3zl8ObnS5GWea86mu3vy4+8H+ZBKkUN82Zsq/zg==} dependencies: - '@algolia/requester-common': 4.19.0 + '@algolia/requester-common': 4.19.1 dev: false - /@algolia/requester-common@4.19.0: - resolution: {integrity: sha512-oBsoYDNx09L163N9aQM/FrGfLoU/sLvvzcHw1fdJg5eysTAXCvdMNXk29ocy0rhq2deQ8ccdU/Z9Qu0RfLGUmA==} + /@algolia/requester-common@4.19.1: + resolution: {integrity: sha512-BisRkcWVxrDzF1YPhAckmi2CFYK+jdMT60q10d7z3PX+w6fPPukxHRnZwooiTUrzFe50UBmLItGizWHP5bDzVQ==} dev: false - /@algolia/requester-node-http@4.19.0: - resolution: {integrity: sha512-UkTZEg5q9VTqfa8cPJbeDpu0Ff50aPx2MxGoYP2v25NFFcTlYRufiPBtux0ZKSyXTaoNPm/OBldWlDi9bTx1jA==} + /@algolia/requester-node-http@4.19.1: + resolution: {integrity: sha512-6DK52DHviBHTG2BK/Vv2GIlEw7i+vxm7ypZW0Z7vybGCNDeWzADx+/TmxjkES2h15+FZOqVf/Ja677gePsVItA==} dependencies: - '@algolia/requester-common': 4.19.0 + '@algolia/requester-common': 4.19.1 dev: false - /@algolia/transporter@4.19.0: - resolution: {integrity: sha512-xgpU6eTzHJ8rqEvhVW9DdyIC+rsRYovIGpCz8k9JjwpLHNltu8wTQik0hasb1z16mFaIQDzgJTxo/C4ciMMr6w==} + /@algolia/transporter@4.19.1: + resolution: {integrity: sha512-nkpvPWbpuzxo1flEYqNIbGz7xhfhGOKGAZS7tzC+TELgEmi7z99qRyTfNSUlW7LZmB3ACdnqAo+9A9KFBENviQ==} dependencies: - '@algolia/cache-common': 4.19.0 - '@algolia/logger-common': 4.19.0 - '@algolia/requester-common': 4.19.0 + '@algolia/cache-common': 4.19.1 + '@algolia/logger-common': 4.19.1 + '@algolia/requester-common': 4.19.1 dev: false /@babel/code-frame@7.22.5: @@ -488,10 +488,10 @@ packages: resolution: {integrity: sha512-2Pu9HDg/uP/IT10rbQ+4OrTQuxIWdKVUEdcw9/w7kZJv9NeHS6skJx1xuRiFyoGKwAzcHXnLp7csE99sj+O1YA==} dev: false - /@docsearch/js@3.5.1(@algolia/client-search@4.19.0)(search-insights@2.7.0): + /@docsearch/js@3.5.1(@algolia/client-search@4.19.1)(search-insights@2.7.0): resolution: {integrity: sha512-EXi8de5njxgP6TV3N9ytnGRLG9zmBNTEZjR4VzwPcpPLbZxxTLG2gaFyJyKiFVQxHW/DPlMrDJA3qoRRGEkgZw==} dependencies: - '@docsearch/react': 3.5.1(@algolia/client-search@4.19.0)(search-insights@2.7.0) + '@docsearch/react': 3.5.1(@algolia/client-search@4.19.1)(search-insights@2.7.0) preact: 10.16.0 transitivePeerDependencies: - '@algolia/client-search' @@ -501,7 +501,7 @@ packages: - search-insights dev: false - /@docsearch/react@3.5.1(@algolia/client-search@4.19.0)(search-insights@2.7.0): + /@docsearch/react@3.5.1(@algolia/client-search@4.19.1)(search-insights@2.7.0): resolution: {integrity: sha512-t5mEODdLzZq4PTFAm/dvqcvZFdPDMdfPE5rJS5SC8OUq9mPzxEy6b+9THIqNM9P0ocCb4UC5jqBrxKclnuIbzQ==} peerDependencies: '@types/react': '>= 16.8.0 < 19.0.0' @@ -515,185 +515,185 @@ packages: react-dom: optional: true dependencies: - '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0)(search-insights@2.7.0) - '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.19.0)(algoliasearch@4.19.0) + '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1)(search-insights@2.7.0) + '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.19.1)(algoliasearch@4.19.1) '@docsearch/css': 3.5.1 - algoliasearch: 4.19.0 + algoliasearch: 4.19.1 transitivePeerDependencies: - '@algolia/client-search' - search-insights dev: false - /@esbuild/android-arm64@0.18.14: - resolution: {integrity: sha512-rZ2v+Luba5/3D6l8kofWgTnqE+qsC/L5MleKIKFyllHTKHrNBMqeRCnZI1BtRx8B24xMYxeU32iIddRQqMsOsg==} + /@esbuild/android-arm64@0.18.15: + resolution: {integrity: sha512-NI/gnWcMl2kXt1HJKOn2H69SYn4YNheKo6NZt1hyfKWdMbaGadxjZIkcj4Gjk/WPxnbFXs9/3HjGHaknCqjrww==} engines: {node: '>=12'} cpu: [arm64] os: [android] requiresBuild: true optional: true - /@esbuild/android-arm@0.18.14: - resolution: {integrity: sha512-blODaaL+lngG5bdK/t4qZcQvq2BBqrABmYwqPPcS5VRxrCSGHb9R/rA3fqxh7R18I7WU4KKv+NYkt22FDfalcg==} + /@esbuild/android-arm@0.18.15: + resolution: {integrity: sha512-wlkQBWb79/jeEEoRmrxt/yhn5T1lU236OCNpnfRzaCJHZ/5gf82uYx1qmADTBWE0AR/v7FiozE1auk2riyQd3w==} engines: {node: '>=12'} cpu: [arm] os: [android] requiresBuild: true optional: true - /@esbuild/android-x64@0.18.14: - resolution: {integrity: sha512-qSwh8y38QKl+1Iqg+YhvCVYlSk3dVLk9N88VO71U4FUjtiSFylMWK3Ugr8GC6eTkkP4Tc83dVppt2n8vIdlSGg==} + /@esbuild/android-x64@0.18.15: + resolution: {integrity: sha512-FM9NQamSaEm/IZIhegF76aiLnng1kEsZl2eve/emxDeReVfRuRNmvT28l6hoFD9TsCxpK+i4v8LPpEj74T7yjA==} engines: {node: '>=12'} cpu: [x64] os: [android] requiresBuild: true optional: true - /@esbuild/darwin-arm64@0.18.14: - resolution: {integrity: sha512-9Hl2D2PBeDYZiNbnRKRWuxwHa9v5ssWBBjisXFkVcSP5cZqzZRFBUWEQuqBHO4+PKx4q4wgHoWtfQ1S7rUqJ2Q==} + /@esbuild/darwin-arm64@0.18.15: + resolution: {integrity: sha512-XmrFwEOYauKte9QjS6hz60FpOCnw4zaPAb7XV7O4lx1r39XjJhTN7ZpXqJh4sN6q60zbP6QwAVVA8N/wUyBH/w==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] requiresBuild: true optional: true - /@esbuild/darwin-x64@0.18.14: - resolution: {integrity: sha512-ZnI3Dg4ElQ6tlv82qLc/UNHtFsgZSKZ7KjsUNAo1BF1SoYDjkGKHJyCrYyWjFecmXpvvG/KJ9A/oe0H12odPLQ==} + /@esbuild/darwin-x64@0.18.15: + resolution: {integrity: sha512-bMqBmpw1e//7Fh5GLetSZaeo9zSC4/CMtrVFdj+bqKPGJuKyfNJ5Nf2m3LknKZTS+Q4oyPiON+v3eaJ59sLB5A==} engines: {node: '>=12'} cpu: [x64] os: [darwin] requiresBuild: true optional: true - /@esbuild/freebsd-arm64@0.18.14: - resolution: {integrity: sha512-h3OqR80Da4oQCIa37zl8tU5MwHQ7qgPV0oVScPfKJK21fSRZEhLE4IIVpmcOxfAVmqjU6NDxcxhYaM8aDIGRLw==} + /@esbuild/freebsd-arm64@0.18.15: + resolution: {integrity: sha512-LoTK5N3bOmNI9zVLCeTgnk5Rk0WdUTrr9dyDAQGVMrNTh9EAPuNwSTCgaKOKiDpverOa0htPcO9NwslSE5xuLA==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] requiresBuild: true optional: true - /@esbuild/freebsd-x64@0.18.14: - resolution: {integrity: sha512-ha4BX+S6CZG4BoH9tOZTrFIYC1DH13UTCRHzFc3GWX74nz3h/N6MPF3tuR3XlsNjMFUazGgm35MPW5tHkn2lzQ==} + /@esbuild/freebsd-x64@0.18.15: + resolution: {integrity: sha512-62jX5n30VzgrjAjOk5orYeHFq6sqjvsIj1QesXvn5OZtdt5Gdj0vUNJy9NIpjfdNdqr76jjtzBJKf+h2uzYuTQ==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] requiresBuild: true optional: true - /@esbuild/linux-arm64@0.18.14: - resolution: {integrity: sha512-IXORRe22In7U65NZCzjwAUc03nn8SDIzWCnfzJ6t/8AvGx5zBkcLfknI+0P+hhuftufJBmIXxdSTbzWc8X/V4w==} + /@esbuild/linux-arm64@0.18.15: + resolution: {integrity: sha512-BWncQeuWDgYv0jTNzJjaNgleduV4tMbQjmk/zpPh/lUdMcNEAxy+jvneDJ6RJkrqloG7tB9S9rCrtfk/kuplsQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-arm@0.18.14: - resolution: {integrity: sha512-5+7vehI1iqru5WRtJyU2XvTOvTGURw3OZxe3YTdE9muNNIdmKAVmSHpB3Vw2LazJk2ifEdIMt/wTWnVe5V98Kg==} + /@esbuild/linux-arm@0.18.15: + resolution: {integrity: sha512-dT4URUv6ir45ZkBqhwZwyFV6cH61k8MttIwhThp2BGiVtagYvCToF+Bggyx2VI57RG4Fbt21f9TmXaYx0DeUJg==} engines: {node: '>=12'} cpu: [arm] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-ia32@0.18.14: - resolution: {integrity: sha512-BfHlMa0nibwpjG+VXbOoqJDmFde4UK2gnW351SQ2Zd4t1N3zNdmUEqRkw/srC1Sa1DRBE88Dbwg4JgWCbNz/FQ==} + /@esbuild/linux-ia32@0.18.15: + resolution: {integrity: sha512-JPXORvgHRHITqfms1dWT/GbEY89u848dC08o0yK3fNskhp0t2TuNUnsrrSgOdH28ceb1hJuwyr8R/1RnyPwocw==} engines: {node: '>=12'} cpu: [ia32] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-loong64@0.18.14: - resolution: {integrity: sha512-j2/Ex++DRUWIAaUDprXd3JevzGtZ4/d7VKz+AYDoHZ3HjJzCyYBub9CU1wwIXN+viOP0b4VR3RhGClsvyt/xSw==} + /@esbuild/linux-loong64@0.18.15: + resolution: {integrity: sha512-kArPI0DopjJCEplsVj/H+2Qgzz7vdFSacHNsgoAKpPS6W/Ndh8Oe24HRDQ5QCu4jHgN6XOtfFfLpRx3TXv/mEg==} engines: {node: '>=12'} cpu: [loong64] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-mips64el@0.18.14: - resolution: {integrity: sha512-qn2+nc+ZCrJmiicoAnJXJJkZWt8Nwswgu1crY7N+PBR8ChBHh89XRxj38UU6Dkthl2yCVO9jWuafZ24muzDC/A==} + /@esbuild/linux-mips64el@0.18.15: + resolution: {integrity: sha512-b/tmngUfO02E00c1XnNTw/0DmloKjb6XQeqxaYuzGwHe0fHVgx5/D6CWi+XH1DvkszjBUkK9BX7n1ARTOst59w==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-ppc64@0.18.14: - resolution: {integrity: sha512-aGzXzd+djqeEC5IRkDKt3kWzvXoXC6K6GyYKxd+wsFJ2VQYnOWE954qV2tvy5/aaNrmgPTb52cSCHFE+Z7Z0yg==} + /@esbuild/linux-ppc64@0.18.15: + resolution: {integrity: sha512-KXPY69MWw79QJkyvUYb2ex/OgnN/8N/Aw5UDPlgoRtoEfcBqfeLodPr42UojV3NdkoO4u10NXQdamWm1YEzSKw==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-riscv64@0.18.14: - resolution: {integrity: sha512-8C6vWbfr0ygbAiMFLS6OPz0BHvApkT2gCboOGV76YrYw+sD/MQJzyITNsjZWDXJwPu9tjrFQOVG7zijRzBCnLw==} + /@esbuild/linux-riscv64@0.18.15: + resolution: {integrity: sha512-komK3NEAeeGRnvFEjX1SfVg6EmkfIi5aKzevdvJqMydYr9N+pRQK0PGJXk+bhoPZwOUgLO4l99FZmLGk/L1jWg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-s390x@0.18.14: - resolution: {integrity: sha512-G/Lf9iu8sRMM60OVGOh94ZW2nIStksEcITkXdkD09/T6QFD/o+g0+9WVyR/jajIb3A0LvBJ670tBnGe1GgXMgw==} + /@esbuild/linux-s390x@0.18.15: + resolution: {integrity: sha512-632T5Ts6gQ2WiMLWRRyeflPAm44u2E/s/TJvn+BP6M5mnHSk93cieaypj3VSMYO2ePTCRqAFXtuYi1yv8uZJNA==} engines: {node: '>=12'} cpu: [s390x] os: [linux] requiresBuild: true optional: true - /@esbuild/linux-x64@0.18.14: - resolution: {integrity: sha512-TBgStYBQaa3EGhgqIDM+ECnkreb0wkcKqL7H6m+XPcGUoU4dO7dqewfbm0mWEQYH3kzFHrzjOFNpSAVzDZRSJw==} + /@esbuild/linux-x64@0.18.15: + resolution: {integrity: sha512-MsHtX0NgvRHsoOtYkuxyk4Vkmvk3PLRWfA4okK7c+6dT0Fu4SUqXAr9y4Q3d8vUf1VWWb6YutpL4XNe400iQ1g==} engines: {node: '>=12'} cpu: [x64] os: [linux] requiresBuild: true optional: true - /@esbuild/netbsd-x64@0.18.14: - resolution: {integrity: sha512-stvCcjyCQR2lMTroqNhAbvROqRjxPEq0oQ380YdXxA81TaRJEucH/PzJ/qsEtsHgXlWFW6Ryr/X15vxQiyRXVg==} + /@esbuild/netbsd-x64@0.18.15: + resolution: {integrity: sha512-djST6s+jQiwxMIVQ5rlt24JFIAr4uwUnzceuFL7BQT4CbrRtqBPueS4GjXSiIpmwVri1Icj/9pFRJ7/aScvT+A==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] requiresBuild: true optional: true - /@esbuild/openbsd-x64@0.18.14: - resolution: {integrity: sha512-apAOJF14CIsN5ht1PA57PboEMsNV70j3FUdxLmA2liZ20gEQnfTG5QU0FhENo5nwbTqCB2O3WDsXAihfODjHYw==} + /@esbuild/openbsd-x64@0.18.15: + resolution: {integrity: sha512-naeRhUIvhsgeounjkF5mvrNAVMGAm6EJWiabskeE5yOeBbLp7T89tAEw0j5Jm/CZAwyLe3c67zyCWH6fsBLCpw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] requiresBuild: true optional: true - /@esbuild/sunos-x64@0.18.14: - resolution: {integrity: sha512-fYRaaS8mDgZcGybPn2MQbn1ZNZx+UXFSUoS5Hd2oEnlsyUcr/l3c6RnXf1bLDRKKdLRSabTmyCy7VLQ7VhGdOQ==} + /@esbuild/sunos-x64@0.18.15: + resolution: {integrity: sha512-qkT2+WxyKbNIKV1AEhI8QiSIgTHMcRctzSaa/I3kVgMS5dl3fOeoqkb7pW76KwxHoriImhx7Mg3TwN/auMDsyQ==} engines: {node: '>=12'} cpu: [x64] os: [sunos] requiresBuild: true optional: true - /@esbuild/win32-arm64@0.18.14: - resolution: {integrity: sha512-1c44RcxKEJPrVj62XdmYhxXaU/V7auELCmnD+Ri+UCt+AGxTvzxl9uauQhrFso8gj6ZV1DaORV0sT9XSHOAk8Q==} + /@esbuild/win32-arm64@0.18.15: + resolution: {integrity: sha512-HC4/feP+pB2Vb+cMPUjAnFyERs+HJN7E6KaeBlFdBv799MhD+aPJlfi/yk36SED58J9TPwI8MAcVpJgej4ud0A==} engines: {node: '>=12'} cpu: [arm64] os: [win32] requiresBuild: true optional: true - /@esbuild/win32-ia32@0.18.14: - resolution: {integrity: sha512-EXAFttrdAxZkFQmpvcAQ2bywlWUsONp/9c2lcfvPUhu8vXBBenCXpoq9YkUvVP639ld3YGiYx0YUQ6/VQz3Maw==} + /@esbuild/win32-ia32@0.18.15: + resolution: {integrity: sha512-ovjwoRXI+gf52EVF60u9sSDj7myPixPxqzD5CmkEUmvs+W9Xd0iqISVBQn8xcx4ciIaIVlWCuTbYDOXOnOL44Q==} engines: {node: '>=12'} cpu: [ia32] os: [win32] requiresBuild: true optional: true - /@esbuild/win32-x64@0.18.14: - resolution: {integrity: sha512-K0QjGbcskx+gY+qp3v4/940qg8JitpXbdxFhRDA1aYoNaPff88+aEwoq45aqJ+ogpxQxmU0ZTjgnrQD/w8iiUg==} + /@esbuild/win32-x64@0.18.15: + resolution: {integrity: sha512-imUxH9a3WJARyAvrG7srLyiK73XdX83NXQkjKvQ+7vPh3ZxoLrzvPkQKKw2DwZ+RV2ZB6vBfNHP8XScAmQC3aA==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1149,14 +1149,14 @@ packages: resolution: {integrity: sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==} dev: false - /@vitejs/plugin-vue@4.2.3(vite@4.4.4)(vue@3.3.4): + /@vitejs/plugin-vue@4.2.3(vite@4.4.6)(vue@3.3.4): resolution: {integrity: sha512-R6JDUfiZbJA9cMiguQ7jxALsgiprjBeHL5ikpXfJCH62pPHtI+JdJ5xWj6Ev73yXSlYl86+blXn1kZHQ7uElxw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.4.4(@types/node@20.4.2) + vite: 4.4.6(@types/node@20.4.2) vue: 3.3.4 dev: false @@ -1241,7 +1241,7 @@ packages: '@vue/shared': 3.3.4 estree-walker: 2.0.2 magic-string: 0.30.1 - postcss: 8.4.26 + postcss: 8.4.27 source-map-js: 1.0.2 dev: false @@ -1441,23 +1441,23 @@ packages: indent-string: 4.0.0 dev: true - /algoliasearch@4.19.0: - resolution: {integrity: sha512-UIzLHOkprUFzwFxqgw+TOhEG2usLv8q9l4V/Ul82IgNNO+g5RjENd5Sl/J6BU4BlRdMLy/OvPfbSc7Y1dOdwgA==} - dependencies: - '@algolia/cache-browser-local-storage': 4.19.0 - '@algolia/cache-common': 4.19.0 - '@algolia/cache-in-memory': 4.19.0 - '@algolia/client-account': 4.19.0 - '@algolia/client-analytics': 4.19.0 - '@algolia/client-common': 4.19.0 - '@algolia/client-personalization': 4.19.0 - '@algolia/client-search': 4.19.0 - '@algolia/logger-common': 4.19.0 - '@algolia/logger-console': 4.19.0 - '@algolia/requester-browser-xhr': 4.19.0 - '@algolia/requester-common': 4.19.0 - '@algolia/requester-node-http': 4.19.0 - '@algolia/transporter': 4.19.0 + /algoliasearch@4.19.1: + resolution: {integrity: sha512-IJF5b93b2MgAzcE/tuzW0yOPnuUyRgGAtaPv5UUywXM8kzqfdwZTO4sPJBzoGz1eOy6H9uEchsJsBFTELZSu+g==} + dependencies: + '@algolia/cache-browser-local-storage': 4.19.1 + '@algolia/cache-common': 4.19.1 + '@algolia/cache-in-memory': 4.19.1 + '@algolia/client-account': 4.19.1 + '@algolia/client-analytics': 4.19.1 + '@algolia/client-common': 4.19.1 + '@algolia/client-personalization': 4.19.1 + '@algolia/client-search': 4.19.1 + '@algolia/logger-common': 4.19.1 + '@algolia/logger-console': 4.19.1 + '@algolia/requester-browser-xhr': 4.19.1 + '@algolia/requester-common': 4.19.1 + '@algolia/requester-node-http': 4.19.1 + '@algolia/transporter': 4.19.1 dev: false /ansi-escapes@4.3.2: @@ -2213,34 +2213,34 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild@0.18.14: - resolution: {integrity: sha512-uNPj5oHPYmj+ZhSQeYQVFZ+hAlJZbAGOmmILWIqrGvPVlNLbyOvU5Bu6Woi8G8nskcx0vwY0iFoMPrzT86Ko+w==} + /esbuild@0.18.15: + resolution: {integrity: sha512-3WOOLhrvuTGPRzQPU6waSDWrDTnQriia72McWcn6UCi43GhCHrXH4S59hKMeez+IITmdUuUyvbU9JIp+t3xlPQ==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.18.14 - '@esbuild/android-arm64': 0.18.14 - '@esbuild/android-x64': 0.18.14 - '@esbuild/darwin-arm64': 0.18.14 - '@esbuild/darwin-x64': 0.18.14 - '@esbuild/freebsd-arm64': 0.18.14 - '@esbuild/freebsd-x64': 0.18.14 - '@esbuild/linux-arm': 0.18.14 - '@esbuild/linux-arm64': 0.18.14 - '@esbuild/linux-ia32': 0.18.14 - '@esbuild/linux-loong64': 0.18.14 - '@esbuild/linux-mips64el': 0.18.14 - '@esbuild/linux-ppc64': 0.18.14 - '@esbuild/linux-riscv64': 0.18.14 - '@esbuild/linux-s390x': 0.18.14 - '@esbuild/linux-x64': 0.18.14 - '@esbuild/netbsd-x64': 0.18.14 - '@esbuild/openbsd-x64': 0.18.14 - '@esbuild/sunos-x64': 0.18.14 - '@esbuild/win32-arm64': 0.18.14 - '@esbuild/win32-ia32': 0.18.14 - '@esbuild/win32-x64': 0.18.14 + '@esbuild/android-arm': 0.18.15 + '@esbuild/android-arm64': 0.18.15 + '@esbuild/android-x64': 0.18.15 + '@esbuild/darwin-arm64': 0.18.15 + '@esbuild/darwin-x64': 0.18.15 + '@esbuild/freebsd-arm64': 0.18.15 + '@esbuild/freebsd-x64': 0.18.15 + '@esbuild/linux-arm': 0.18.15 + '@esbuild/linux-arm64': 0.18.15 + '@esbuild/linux-ia32': 0.18.15 + '@esbuild/linux-loong64': 0.18.15 + '@esbuild/linux-mips64el': 0.18.15 + '@esbuild/linux-ppc64': 0.18.15 + '@esbuild/linux-riscv64': 0.18.15 + '@esbuild/linux-s390x': 0.18.15 + '@esbuild/linux-x64': 0.18.15 + '@esbuild/netbsd-x64': 0.18.15 + '@esbuild/openbsd-x64': 0.18.15 + '@esbuild/sunos-x64': 0.18.15 + '@esbuild/win32-arm64': 0.18.15 + '@esbuild/win32-ia32': 0.18.15 + '@esbuild/win32-x64': 0.18.15 /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} @@ -3633,8 +3633,8 @@ packages: trouter: 3.2.1 dev: true - /postcss@8.4.26: - resolution: {integrity: sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==} + /postcss@8.4.27: + resolution: {integrity: sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==} engines: {node: ^10 || ^12 || >=14} dependencies: nanoid: 3.3.6 @@ -3842,7 +3842,7 @@ packages: '@babel/code-frame': 7.22.5 dev: true - /rollup-plugin-esbuild@5.0.0(esbuild@0.18.14)(rollup@3.26.3)(supports-color@9.4.0): + /rollup-plugin-esbuild@5.0.0(esbuild@0.18.15)(rollup@3.26.3)(supports-color@9.4.0): resolution: {integrity: sha512-1cRIOHAPh8WQgdQQyyvFdeOdxuiyk+zB5zJ5+YOwrZP4cJ0MT3Fs48pQxrZeyZHcn+klFherytILVfE4aYrneg==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} peerDependencies: @@ -3852,7 +3852,7 @@ packages: '@rollup/pluginutils': 5.0.2(rollup@3.26.3) debug: 4.3.4(supports-color@9.4.0) es-module-lexer: 1.3.0 - esbuild: 0.18.14 + esbuild: 0.18.15 joycon: 3.1.1 jsonc-parser: 3.2.0 rollup: 3.26.3 @@ -4457,7 +4457,7 @@ packages: mlly: 1.4.0 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.4.4(@types/node@20.4.2) + vite: 4.4.6(@types/node@20.4.2) transitivePeerDependencies: - '@types/node' - less @@ -4469,8 +4469,8 @@ packages: - terser dev: true - /vite@4.4.4(@types/node@20.4.2): - resolution: {integrity: sha512-4mvsTxjkveWrKDJI70QmelfVqTm+ihFAb6+xf4sjEU2TmUCTlVX87tmg/QooPEMQb/lM9qGHT99ebqPziEd3wg==} + /vite@4.4.6(@types/node@20.4.2): + resolution: {integrity: sha512-EY6Mm8vJ++S3D4tNAckaZfw3JwG3wa794Vt70M6cNJ6NxT87yhq7EC8Rcap3ahyHdo8AhCmV9PTk+vG1HiYn1A==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -4498,8 +4498,8 @@ packages: optional: true dependencies: '@types/node': 20.4.2 - esbuild: 0.18.14 - postcss: 8.4.26 + esbuild: 0.18.15 + postcss: 8.4.27 rollup: 3.26.3 optionalDependencies: fsevents: 2.3.2 @@ -4556,7 +4556,7 @@ packages: strip-literal: 1.0.1 tinybench: 2.5.0 tinypool: 0.6.0 - vite: 4.4.4(@types/node@20.4.2) + vite: 4.4.6(@types/node@20.4.2) vite-node: 0.33.0(@types/node@20.4.2)(supports-color@9.4.0) why-is-node-running: 2.2.2 transitivePeerDependencies: diff --git a/src/node/plugins/localSearchPlugin.ts b/src/node/plugins/localSearchPlugin.ts index 6c54d5bc..eca0f203 100644 --- a/src/node/plugins/localSearchPlugin.ts +++ b/src/node/plugins/localSearchPlugin.ts @@ -4,8 +4,7 @@ import MiniSearch from 'minisearch' import path from 'path' import type { Plugin, ViteDevServer } from 'vite' import type { SiteConfig } from '../config' -import type { MarkdownEnv } from '../markdown' -import { createMarkdownRenderer } from '../markdown' +import { createMarkdownRenderer, type MarkdownEnv } from '../markdown' import { resolveSiteDataByRoute, slash, type DefaultTheme } from '../shared' const debug = _debug('vitepress:local-search') @@ -46,14 +45,23 @@ export async function localSearchPlugin( siteConfig.logger ) - function createMarkdownEnv(file: string): MarkdownEnv { - const { srcDir, cleanUrls = false } = siteConfig + function render(file: string) { + const { srcDir, cleanUrls = false, site } = siteConfig const relativePath = slash(path.relative(srcDir, file)) - return { + const env: MarkdownEnv = { path: file, relativePath, cleanUrls } + const html = md.render(fs.readFileSync(file, 'utf-8'), env) + if ( + env.frontmatter?.search === false || + (site.themeConfig.search?.provider === 'local' && + site.themeConfig.search.options?.exclude?.(relativePath)) + ) { + return '' + } + return html } const indexByLocales = new Map>() @@ -123,9 +131,8 @@ export async function localSearchPlugin( .filter((file) => fs.existsSync(file)) .map(async (file) => { const fileId = getDocId(file) - const sections = splitPageIntoSections( - md.render(await fs.readFile(file, 'utf-8'), createMarkdownEnv(file)) - ) + const sections = splitPageIntoSections(render(file)) + if (sections.length === 0) return const locale = getLocaleForPath(file) let documents = documentsByLocale.get(locale) if (!documents) { @@ -159,6 +166,17 @@ export async function localSearchPlugin( return { name: 'vitepress:local-search', + config: () => ({ + optimizeDeps: { + include: [ + // FIXME! + // 'vitepress > @vueuse/integrations/useFocusTrap', + // 'vitepress > mark.js/src/vanilla.js', + 'vitepress > minisearch' + ] + } + }), + async configureServer(_server) { server = _server await scanForBuild() @@ -196,19 +214,13 @@ export async function localSearchPlugin( } }, - async handleHotUpdate(ctx) { - if (ctx.file.endsWith('.md')) { - const fileId = getDocId(ctx.file) - if (!fs.existsSync(ctx.file)) { - return - } - const index = getIndexForPath(ctx.file) - const sections = splitPageIntoSections( - md.render( - await fs.readFile(ctx.file, 'utf-8'), - createMarkdownEnv(ctx.file) - ) - ) + async handleHotUpdate({ file }) { + if (file.endsWith('.md')) { + const fileId = getDocId(file) + if (!fs.existsSync(file)) return + const index = getIndexForPath(file) + const sections = splitPageIntoSections(render(file)) + if (sections.length === 0) return for (const section of sections) { const id = `${fileId}#${section.anchor}` if (index.has(id)) { @@ -221,7 +233,7 @@ export async function localSearchPlugin( titles: section.titles.slice(0, -1) }) } - debug('🔍️ Updated', ctx.file) + debug('🔍️ Updated', file) onIndexUpdated() } diff --git a/src/node/utils/fnSerialize.ts b/src/node/utils/fnSerialize.ts index 78e7d78f..f3022eec 100644 --- a/src/node/utils/fnSerialize.ts +++ b/src/node/utils/fnSerialize.ts @@ -1,13 +1,20 @@ -export function serializeFunctions(value: any): any { +export function serializeFunctions(value: any, key?: string): any { if (Array.isArray(value)) { - return value.map(serializeFunctions) + return value.map((v) => serializeFunctions(v)) } else if (typeof value === 'object' && value !== null) { return Object.keys(value).reduce((acc, key) => { - acc[key] = serializeFunctions(value[key]) + acc[key] = serializeFunctions(value[key], key) return acc }, {} as any) } else if (typeof value === 'function') { - return `_vp-fn_${value.toString()}` + let serialized = value.toString() + if ( + key && + (serialized.startsWith(key) || serialized.startsWith('async ' + key)) + ) { + serialized = serialized.replace(key, 'function') + } + return `_vp-fn_${serialized}` } else { return value } diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index b0ea5dbb..44091bfb 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -350,6 +350,11 @@ export namespace DefaultTheme { */ searchOptions?: MiniSearchOptions['searchOptions'] } + + /** + * exclude content from search results + */ + exclude?: (relativePath: string) => boolean } // algolia -------------------------------------------------------------------