From f5b77d76a310c90f25f3ecdabf6dffd69a89a5c2 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 31 Mar 2025 16:50:09 +0800 Subject: [PATCH 01/46] feat(plugin-meilisearch): add code to repo --- .../search/plugin-meilisearch/package.json | 50 +++ .../src/client/MeiliSearch.vue | 17 + .../plugin-meilisearch/src/client/define.ts | 137 +++++++ .../plugin-meilisearch/src/client/index.ts | 11 + .../search/plugin-meilisearch/src/index.ts | 14 + .../search/plugin-meilisearch/src/shim.d.ts | 5 + .../plugin-meilisearch/tsconfig.build.json | 15 + .../search/plugin-meilisearch/tsup.config.ts | 14 + pnpm-lock.yaml | 342 ++++++++++++++++++ tsconfig.build.json | 1 + 10 files changed, 606 insertions(+) create mode 100644 plugins/search/plugin-meilisearch/package.json create mode 100644 plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue create mode 100644 plugins/search/plugin-meilisearch/src/client/define.ts create mode 100644 plugins/search/plugin-meilisearch/src/client/index.ts create mode 100644 plugins/search/plugin-meilisearch/src/index.ts create mode 100644 plugins/search/plugin-meilisearch/src/shim.d.ts create mode 100644 plugins/search/plugin-meilisearch/tsconfig.build.json create mode 100644 plugins/search/plugin-meilisearch/tsup.config.ts diff --git a/plugins/search/plugin-meilisearch/package.json b/plugins/search/plugin-meilisearch/package.json new file mode 100644 index 0000000000..df50628a61 --- /dev/null +++ b/plugins/search/plugin-meilisearch/package.json @@ -0,0 +1,50 @@ +{ + "name": "vuepress-plugin-meilisearch2", + "description": "Added the meilisearch search plugin to Vuepress2.x", + "version": "0.5.1", + "module": "./lib/index.js", + "exports": { + ".": { + "import": "./lib/index.js" + } + }, + "files": [ + "lib" + ], + "types": "./lib/index.d.ts", + "type": "module", + "scripts": { + "build": "tsc -b tsconfig.build.json", + "bundle": "tsup", + "copy": "cpx \"src/**/*.{vue,svg,js,css}\" lib" + }, + "author": "JQiue", + "repository": { + "type": "git", + "url": "git+https://github.com/JQiue/vuepress-plugin-meilisearch2.git" + }, + "bugs": { + "url": "https://github.com/JQiue/vuepress-plugin-meilisearch2/issues" + }, + "keywords": [ + "vuepress", + "vuepress-plugin", + "meilisearch", + "vuepress-next" + ], + "license": "MIT", + "dependencies": { + "@vuepress/utils": "2.0.0-rc.20", + "@hyrious/esbuild-plugin-commonjs": "0.2.5", + "meilisearch-docsearch": "^0.7.1", + "vue": "^3.5.13" + }, + "devDependencies": { + "cpx2": "8.0.0", + "ts-node": "^10.9.2", + "tsconfig-vuepress": "5.2.1", + "tsup": "^8.0.2", + "typescript": "^5.4.3", + "vuepress": "2.0.0-rc.20" + } +} diff --git a/plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue b/plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue new file mode 100644 index 0000000000..5fe4fac977 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue @@ -0,0 +1,17 @@ + + + diff --git a/plugins/search/plugin-meilisearch/src/client/define.ts b/plugins/search/plugin-meilisearch/src/client/define.ts new file mode 100644 index 0000000000..0eaa03d019 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/define.ts @@ -0,0 +1,137 @@ +type DocSearchHotKeys = string[] | false + +interface Query { + q?: string | null +} + +interface Pagination { + offset?: number + limit?: number +} + +interface Highlight { + attributesToHighlight?: string[] + highlightPreTag?: string + highlightPostTag?: string +} + +interface Crop { + attributesToCrop?: string[] + cropLength?: number + cropMarker?: string +} + +type Filter = (string[] | string)[] | string + +type Locale = string + +interface HybridSearch { + embedder?: string + semanticRatio?: number +} + +const MatchingStrategies = { + ALL: 'all', + LAST: 'last', + FREQUENCY: 'frequency', +} as const + +type MatchingStrategies = + (typeof MatchingStrategies)[keyof typeof MatchingStrategies] + +type SearchParams = Crop & + Highlight & + Pagination & + Query & { + filter?: Filter + sort?: string[] + facets?: string[] + attributesToRetrieve?: string[] + showMatchesPosition?: boolean + matchingStrategy?: MatchingStrategies + hitsPerPage?: number + page?: number + facetName?: string + facetQuery?: string + vector?: number[] | null + showRankingScore?: boolean + showRankingScoreDetails?: boolean + rankingScoreThreshold?: number + attributesToSearchOn?: string[] | null + hybrid?: HybridSearch + distinct?: string + retrieveVectors?: boolean + locales?: Locale[] + } + +export interface DocSearchProps { + host: string + apiKey: string + indexUid: string + clientAgents?: string[] + /** + * An array of hotkeys to trigger the search modal. + * Can be either a single character, for example `s` or `/`, + * or a combination of modifiers and key, for example `ctrl+k`. + * + * Default keys are `['ctrl+k', 's', '/']` + * + * Set to `false` to disable default keys. + */ + hotKeys?: DocSearchHotKeys + translations?: DocSearchTranslations + searchParams?: SearchParams + environment?: typeof window + /** + * Duration to wait between keystores to determine whether a search should happen or not. + * Defaults to `200`. + * + * Set to `false` to disable debouncing. + * + * This is an optimization that discards unnecessary search operations, for example, + * if a user is typing `hello`, we skip search operations for `h`, `he`, `hel` and `hell` + * as this usually not what the user wants to search for, and instead wait a few milliseconds until + * the user stops typing for a brief moment, and then we do the search operation. + * In the previous example, that would be `hello`. + */ + debounceDuration?: number | false +} + +type ButtonTranslations = Partial<{ + buttonText: string + buttonAriaLabel: string +}> + +type FooterTranslations = Partial<{ + selectText: string + selectKeyAriaLabel: string + navigateText: string + navigateUpKeyAriaLabel: string + navigateDownKeyAriaLabel: string + closeText: string + closeKeyAriaLabel: string + poweredByText: string +}> + +type SearchBoxTranslations = Partial<{ + searchDocsPlaceHolder: string + resetButtonTitle: string + resetButtonAriaLabel: string + cancelButtonText: string + cancelButtonAriaLabel: string +}> + +type ModalTranslations = FooterTranslations & + Partial<{ + linkToTheResultAriaLabel: string + }> & + SearchBoxTranslations + +type DocSearchTranslations = Partial<{ + button: ButtonTranslations + modal: ModalTranslations +}> + +declare const OPTIONS: DocSearchProps + +export const pluginOptions = OPTIONS diff --git a/plugins/search/plugin-meilisearch/src/client/index.ts b/plugins/search/plugin-meilisearch/src/client/index.ts new file mode 100644 index 0000000000..f24370fcaa --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/index.ts @@ -0,0 +1,11 @@ +import { defineAsyncComponent } from 'vue' +import { defineClientConfig } from 'vuepress/client' + +export default defineClientConfig({ + enhance({ app }) { + app.component( + 'SearchBox', + defineAsyncComponent(() => import('./MeiliSearch.vue')), + ) + }, +}) diff --git a/plugins/search/plugin-meilisearch/src/index.ts b/plugins/search/plugin-meilisearch/src/index.ts new file mode 100644 index 0000000000..2a52d307e0 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/index.ts @@ -0,0 +1,14 @@ +import { getDirname, path } from '@vuepress/utils' +import type { DocSearchProps } from './client/define' + +const __dirname = getDirname(import.meta.url) + +export const MeiliSearchPlugin = (options: DocSearchProps) => { + return { + name: 'vuepress-plugin-meilisearch', + clientConfigFile: path.resolve(__dirname, './client/index.js'), + define: { + OPTIONS: options, + }, + } +} diff --git a/plugins/search/plugin-meilisearch/src/shim.d.ts b/plugins/search/plugin-meilisearch/src/shim.d.ts new file mode 100644 index 0000000000..bf554924f3 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/shim.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import type { ComponentOptions } from 'vue' + const comp: ComponentOptions + export default comp +} diff --git a/plugins/search/plugin-meilisearch/tsconfig.build.json b/plugins/search/plugin-meilisearch/tsconfig.build.json new file mode 100644 index 0000000000..c5f921ae5d --- /dev/null +++ b/plugins/search/plugin-meilisearch/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.build.json", + "compilerOptions": { + "lib": ["DOM", "ES2022"], + "module": "ESNext", + "moduleResolution": "Bundler", + "skipLibCheck": true, + "target": "ES2022", + "types": ["vuepress/client-types"], + "verbatimModuleSyntax": true, + "noEmit": true, + "allowImportingTsExtensions": true + }, + "include": ["./src/**/*"] +} diff --git a/plugins/search/plugin-meilisearch/tsup.config.ts b/plugins/search/plugin-meilisearch/tsup.config.ts new file mode 100644 index 0000000000..cc5baba19c --- /dev/null +++ b/plugins/search/plugin-meilisearch/tsup.config.ts @@ -0,0 +1,14 @@ +import { commonjs } from '@hyrious/esbuild-plugin-commonjs' +import { defineConfig } from 'tsup' + +export default defineConfig({ + clean: true, + dts: true, + entryPoints: ['src/index.ts', 'src/client/index.ts', 'src/client/define.ts'], + esbuildPlugins: [commonjs()], + + format: ['esm'], + outDir: 'lib', + external: [/\.vue$/u, /^@internal/u], + target: 'node20', +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8eaca13a34..c7837fd287 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1064,6 +1064,40 @@ importers: specifier: 5.23.0 version: 5.23.0 + plugins/search/plugin-meilisearch: + dependencies: + '@hyrious/esbuild-plugin-commonjs': + specifier: 0.2.5 + version: 0.2.5(esbuild@0.25.1) + '@vuepress/utils': + specifier: 2.0.0-rc.20 + version: 2.0.0-rc.20 + meilisearch-docsearch: + specifier: ^0.7.1 + version: 0.7.1 + vue: + specifier: ^3.5.13 + version: 3.5.13(typescript@5.8.2) + devDependencies: + cpx2: + specifier: 8.0.0 + version: 8.0.0 + ts-node: + specifier: ^10.9.2 + version: 10.9.2(@types/node@22.13.14)(typescript@5.8.2) + tsconfig-vuepress: + specifier: 5.2.1 + version: 5.2.1 + tsup: + specifier: ^8.0.2 + version: 8.4.0(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0) + typescript: + specifier: ^5.4.3 + version: 5.8.2 + vuepress: + specifier: 2.0.0-rc.20 + version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.1)(typescript@5.8.2))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)) + plugins/search/plugin-search: dependencies: '@vuepress/helper': @@ -2045,6 +2079,10 @@ packages: conventional-commits-parser: optional: true + '@cspotcode/source-map-support@0.8.1': + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} + '@csstools/css-parser-algorithms@3.0.4': resolution: {integrity: sha512-Up7rBoV77rv29d3uKHUIVubz1BTcgyUK72IvCQAbfbMv584xHcGKCKbWh7i8hPrRJ7qU4Y8IO3IY9m+iTB7P3A==} engines: {node: '>=18'} @@ -2324,6 +2362,16 @@ packages: resolution: {integrity: sha512-e5+YUKENATs1JgYHMzTr2MW/NDcXGfYFAuOQU8gJgF/kEh4EqKgfGrfLI67bMD4tbhZVlkigz/9YYwWcbOFthg==} engines: {node: '>=10.13.0'} + '@hyrious/esbuild-plugin-commonjs@0.2.5': + resolution: {integrity: sha512-6HZzvSq89ek4f5g6Iif2K5iI+8frkZl8W8y35XfkEy3jRGLfu9eXGIr36UrAH7Ux730rgwaPXL3EAcJHrLdoPA==} + engines: {node: '>=14'} + peerDependencies: + cjs-module-lexer: '*' + esbuild: ^0.25.0 + peerDependenciesMeta: + cjs-module-lexer: + optional: true + '@inquirer/checkbox@4.1.4': resolution: {integrity: sha512-d30576EZdApjAMceijXA5jDzRQHT/MygbC+J8I7EqA6f/FRpYxlRtRJbHF8gHeWYeSdOuTEJqonn7QLB1ELezA==} engines: {node: '>=18'} @@ -2489,6 +2537,9 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@jridgewell/trace-mapping@0.3.9': + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + '@jsonjoy.com/base64@1.1.2': resolution: {integrity: sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==} engines: {node: '>=10.0'} @@ -3295,6 +3346,18 @@ packages: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} + '@tsconfig/node10@1.0.11': + resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} + + '@tsconfig/node12@1.0.11': + resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + + '@tsconfig/node14@1.0.3': + resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + + '@tsconfig/node16@1.0.4': + resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + '@tufjs/canonical-json@2.0.0': resolution: {integrity: sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -3835,6 +3898,10 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + acorn-walk@8.3.4: + resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} + engines: {node: '>=0.4.0'} + acorn@8.14.1: resolution: {integrity: sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==} engines: {node: '>=0.4.0'} @@ -3898,6 +3965,9 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} + any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -3905,6 +3975,9 @@ packages: aproba@2.0.0: resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} + arg@4.1.3: + resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + arg@5.0.2: resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} @@ -4064,6 +4137,12 @@ packages: resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} engines: {node: '>=18'} + bundle-require@5.1.0: + resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: ^0.25.0 + byte-size@9.0.1: resolution: {integrity: sha512-YLe9x3rabBrcI0cueCdLS2l5ONUKywcRpTs02B8KP9/Cimhj7o3ZccGrPnRvcbyHMbb7W79/3MUJl7iGgTXKEw==} engines: {node: '>=12.17'} @@ -4254,6 +4333,10 @@ packages: commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + commander@7.2.0: resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==} engines: {node: '>= 10'} @@ -4300,6 +4383,10 @@ packages: resolution: {integrity: sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==} engines: {node: '>=0.8'} + consola@3.4.2: + resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} + engines: {node: ^14.18.0 || >=16.10.0} + console-control-strings@1.1.0: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} @@ -4443,6 +4530,9 @@ packages: engines: {node: ^20.0.0 || >=22.0.0, npm: '>=10'} hasBin: true + create-require@1.1.1: + resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + cross-env@7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -4695,6 +4785,10 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + diff@4.0.2: + resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} + engines: {node: '>=0.3.1'} + dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -5906,6 +6000,10 @@ packages: resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} hasBin: true + joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -6107,6 +6205,10 @@ packages: resolution: {integrity: sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + loader-runner@4.3.0: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} @@ -6209,6 +6311,9 @@ packages: resolution: {integrity: sha512-G0yBotnlWVonPClw+tq+xi4K7DZC9n96HjGTBDdHkstAVsDkfZhi1sTvZypXLpyQTbISBkDtK0E5XlUqDsShQg==} engines: {node: '>=18'} + make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + make-fetch-happen@14.0.3: resolution: {integrity: sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==} engines: {node: ^18.17.0 || >=20.5.0} @@ -6316,6 +6421,12 @@ packages: medium-zoom@1.1.0: resolution: {integrity: sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==} + meilisearch-docsearch@0.7.1: + resolution: {integrity: sha512-57VfY01JpQ5+wLNSEjkmo8/Km25II+oqPIqiAXt2O/dfN5OiLqEwtdhP2dE12V9kb19FtIoJ+l4DIYv33nGmgg==} + + meilisearch@0.49.0: + resolution: {integrity: sha512-oMJ/e6Or6cz2+owcEKeB11p2OWiWW9NmssqOZC/KIwQB0sBGKLJ7RCpYzf+GhUIZIZ9FRYZ419ox3RGebVQX5g==} + memfs@4.17.0: resolution: {integrity: sha512-4eirfZ7thblFmqFjywlTmuWVSvccHAJbn1r8qQLzmTO11qcqpohOjmY2mFce6x7x7WtskzRqApPD0hv+Oa74jg==} engines: {node: '>= 4.0.0'} @@ -6544,6 +6655,9 @@ packages: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} + mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + nano-staged@0.8.0: resolution: {integrity: sha512-QSEqPGTCJbkHU2yLvfY6huqYPjdBrOaTMKatO1F8nCSrkQGXeKwtCiCnsdxnuMhbg3DTVywKaeWLGCE5oJpq0g==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -6659,6 +6773,10 @@ packages: nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} @@ -6910,6 +7028,10 @@ packages: resolution: {integrity: sha512-KocF8ve28eFjjuBKKGvzOBGzG8ew2OqOOSxTTZhirkzH7h3BI1vyzqlR0qbfcDBve1Yzo3FVlWUAtCRrbVN8Fw==} engines: {node: '>=14.16'} + pirates@4.0.7: + resolution: {integrity: sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==} + engines: {node: '>= 6'} + pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -7691,6 +7813,16 @@ packages: serialize-javascript@6.0.2: resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} + seroval-plugins@1.2.1: + resolution: {integrity: sha512-H5vs53+39+x4Udwp4J5rNZfgFuA+Lt+uU+09w1gYBVWomtAl98B+E9w7yC05Xc81/HgLvJdlyqJbU0fJCKCmdw==} + engines: {node: '>=10'} + peerDependencies: + seroval: ^1.0 + + seroval@1.2.1: + resolution: {integrity: sha512-yBxFFs3zmkvKNmR0pFSU//rIsYjuX418TnlDmc2weaq5XFDqDIV/NOMPBoLrbxjLH42p4UzRuXHryXh9dYcKcw==} + engines: {node: '>=10'} + serve-index@1.9.1: resolution: {integrity: sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==} engines: {node: '>= 0.8.0'} @@ -7805,6 +7937,9 @@ packages: resolution: {integrity: sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==} engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + solid-js@1.9.5: + resolution: {integrity: sha512-ogI3DaFcyn6UhYhrgcyRAMbu/buBJitYQASZz5WzfQVPP10RD2AbCoRZ517psnezrasyCbWzIxZ6kVqet768xw==} + sort-keys@5.1.0: resolution: {integrity: sha512-aSbHV0DaBcr7u0PVHXzM6NbZNAtrr9sF6+Qfs9UUVG7Ll3jQ6hHi8F/xqIIcn2rvIVbr0v/2zyjSdwSV47AgLQ==} engines: {node: '>=12'} @@ -8052,6 +8187,11 @@ packages: subarg@1.0.0: resolution: {integrity: sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg==} + sucrase@3.35.0: + resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + superjson@2.2.2: resolution: {integrity: sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q==} engines: {node: '>=16'} @@ -8149,6 +8289,13 @@ packages: resolution: {integrity: sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==} engines: {node: '>=8'} + thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + + thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + thingies@1.21.0: resolution: {integrity: sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g==} engines: {node: '>=10.18'} @@ -8204,6 +8351,10 @@ packages: peerDependencies: tslib: '2' + tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + treeverse@3.0.0: resolution: {integrity: sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -8220,12 +8371,48 @@ packages: ts-debounce@4.0.0: resolution: {integrity: sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg==} + ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + + ts-node@10.9.2: + resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + tsconfig-vuepress@5.2.1: resolution: {integrity: sha512-9JI4bozH9ISFRj0KIbSTpyk6Metl7rcICnCFcvdgWj+Hx4L8Z/VuWbAdgzNysiMafILfBLJrfsViEj6ZeW6fHQ==} tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsup@8.4.0: + resolution: {integrity: sha512-b+eZbPCjz10fRryaAA7C8xlIHnf8VnsaRqydheLIqwG/Mcpfk8Z5zp3HayX7GaTygkigHl5cBUs+IhcySiIexQ==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + tsx@4.19.3: resolution: {integrity: sha512-4H8vUNGNjQ4V2EOoGw005+c+dGuPSnhpPBPHBtsZdGZBk/iJb4kguGlPWaZTZ3q5nMtFOEsY0nRDlh9PJyd6SQ==} engines: {node: '>=18.0.0'} @@ -8433,6 +8620,9 @@ packages: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true + v8-compile-cache-lib@3.0.1: + resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -8848,6 +9038,10 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} + yn@3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -9752,6 +9946,10 @@ snapshots: conventional-commits-filter: 5.0.0 conventional-commits-parser: 6.1.0 + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + '@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3)': dependencies: '@csstools/css-tokenizer': 3.0.3 @@ -9953,6 +10151,10 @@ snapshots: '@hutson/parse-repository-url@5.0.0': {} + '@hyrious/esbuild-plugin-commonjs@0.2.5(esbuild@0.25.1)': + dependencies: + esbuild: 0.25.1 + '@inquirer/checkbox@4.1.4(@types/node@22.13.14)': dependencies: '@inquirer/core': 10.1.9(@types/node@22.13.14) @@ -10121,6 +10323,11 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jsonjoy.com/base64@1.1.2(tslib@2.8.1)': dependencies: tslib: 2.8.1 @@ -11040,6 +11247,14 @@ snapshots: '@trysound/sax@0.2.0': {} + '@tsconfig/node10@1.0.11': {} + + '@tsconfig/node12@1.0.11': {} + + '@tsconfig/node14@1.0.3': {} + + '@tsconfig/node16@1.0.4': {} + '@tufjs/canonical-json@2.0.0': {} '@tufjs/models@3.0.1': @@ -11822,6 +12037,10 @@ snapshots: dependencies: acorn: 8.14.1 + acorn-walk@8.3.4: + dependencies: + acorn: 8.14.1 + acorn@8.14.1: {} add-stream@1.0.0: {} @@ -11885,6 +12104,8 @@ snapshots: ansi-styles@6.2.1: {} + any-promise@1.3.0: {} + anymatch@3.1.3: dependencies: normalize-path: 3.0.0 @@ -11892,6 +12113,8 @@ snapshots: aproba@2.0.0: {} + arg@4.1.3: {} + arg@5.0.2: {} argparse@1.0.10: @@ -12064,6 +12287,11 @@ snapshots: dependencies: run-applescript: 7.0.0 + bundle-require@5.1.0(esbuild@0.25.1): + dependencies: + esbuild: 0.25.1 + load-tsconfig: 0.2.5 + byte-size@9.0.1: {} bytes@3.1.2: {} @@ -12258,6 +12486,8 @@ snapshots: commander@2.20.3: {} + commander@4.1.1: {} + commander@7.2.0: {} commander@8.3.0: {} @@ -12302,6 +12532,8 @@ snapshots: connect-history-api-fallback@2.0.0: {} + consola@3.4.2: {} + console-control-strings@1.1.0: {} content-disposition@0.5.4: @@ -12465,6 +12697,8 @@ snapshots: transitivePeerDependencies: - supports-color + create-require@1.1.1: {} + cross-env@7.0.3: dependencies: cross-spawn: 7.0.6 @@ -12694,6 +12928,8 @@ snapshots: dependencies: dequal: 2.0.3 + diff@4.0.2: {} + dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -14101,6 +14337,8 @@ snapshots: jiti@2.4.2: {} + joycon@3.1.1: {} + js-tokens@4.0.0: {} js-tokens@9.0.1: {} @@ -14271,6 +14509,8 @@ snapshots: load-json-file@7.0.1: {} + load-tsconfig@0.2.5: {} + loader-runner@4.3.0: {} loader-utils@2.0.4: @@ -14360,6 +14600,8 @@ snapshots: make-dir@5.0.0: {} + make-error@1.3.6: {} + make-fetch-happen@14.0.3: dependencies: '@npmcli/agent': 3.0.0 @@ -14553,6 +14795,13 @@ snapshots: medium-zoom@1.1.0: {} + meilisearch-docsearch@0.7.1: + dependencies: + meilisearch: 0.49.0 + solid-js: 1.9.5 + + meilisearch@0.49.0: {} + memfs@4.17.0: dependencies: '@jsonjoy.com/json-pack': 1.2.0(tslib@2.8.1) @@ -14828,6 +15077,12 @@ snapshots: mute-stream@2.0.0: {} + mz@2.7.0: + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + nano-staged@0.8.0: dependencies: picocolors: 1.1.1 @@ -14951,6 +15206,8 @@ snapshots: dependencies: boolbase: 1.0.0 + object-assign@4.1.1: {} + object-inspect@1.13.4: {} object-keys@1.1.1: {} @@ -15218,6 +15475,8 @@ snapshots: pify@6.1.0: {} + pirates@4.0.7: {} + pkg-dir@4.2.0: dependencies: find-up: 4.1.0 @@ -15956,6 +16215,12 @@ snapshots: dependencies: randombytes: 2.1.0 + seroval-plugins@1.2.1(seroval@1.2.1): + dependencies: + seroval: 1.2.1 + + seroval@1.2.1: {} + serve-index@1.9.1: dependencies: accepts: 1.3.8 @@ -16113,6 +16378,12 @@ snapshots: ip-address: 9.0.5 smart-buffer: 4.2.0 + solid-js@1.9.5: + dependencies: + csstype: 3.1.3 + seroval: 1.2.1 + seroval-plugins: 1.2.1(seroval@1.2.1) + sort-keys@5.1.0: dependencies: is-plain-obj: 4.1.0 @@ -16429,6 +16700,16 @@ snapshots: dependencies: minimist: 1.2.8 + sucrase@3.35.0: + dependencies: + '@jridgewell/gen-mapping': 0.3.8 + commander: 4.1.1 + glob: 10.4.5 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.7 + ts-interface-checker: 0.1.13 + superjson@2.2.2: dependencies: copy-anything: 3.0.5 @@ -16536,6 +16817,14 @@ snapshots: text-extensions@2.4.0: {} + thenify-all@1.6.0: + dependencies: + thenify: 3.3.1 + + thenify@3.3.1: + dependencies: + any-promise: 1.3.0 + thingies@1.21.0(tslib@2.8.1): dependencies: tslib: 2.8.1 @@ -16577,6 +16866,8 @@ snapshots: dependencies: tslib: 2.8.1 + tree-kill@1.2.2: {} + treeverse@3.0.0: {} trim-lines@3.0.1: {} @@ -16587,10 +16878,57 @@ snapshots: ts-debounce@4.0.0: {} + ts-interface-checker@0.1.13: {} + + ts-node@10.9.2(@types/node@22.13.14)(typescript@5.8.2): + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.11 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 22.13.14 + acorn: 8.14.1 + acorn-walk: 8.3.4 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.8.2 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + tsconfig-vuepress@5.2.1: {} tslib@2.8.1: {} + tsup@8.4.0(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0): + dependencies: + bundle-require: 5.1.0(esbuild@0.25.1) + cac: 6.7.14 + chokidar: 4.0.3 + consola: 3.4.2 + debug: 4.4.0 + esbuild: 0.25.1 + joycon: 3.1.1 + picocolors: 1.1.1 + postcss-load-config: 6.0.1(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.3)(yaml@2.7.0) + resolve-from: 5.0.0 + rollup: 4.37.0 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.12 + tree-kill: 1.2.2 + optionalDependencies: + postcss: 8.5.3 + typescript: 5.8.2 + transitivePeerDependencies: + - jiti + - supports-color + - tsx + - yaml + tsx@4.19.3: dependencies: esbuild: 0.25.1 @@ -16810,6 +17148,8 @@ snapshots: uuid@8.3.2: {} + v8-compile-cache-lib@3.0.1: {} + validate-npm-package-license@3.0.4: dependencies: spdx-correct: 3.2.0 @@ -17364,6 +17704,8 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 + yn@3.1.1: {} + yocto-queue@0.1.0: {} yocto-queue@1.2.1: {} diff --git a/tsconfig.build.json b/tsconfig.build.json index 1726530867..b1d49b5a1c 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -87,6 +87,7 @@ { "path": "./plugins/search/plugin-docsearch/tsconfig.build.json" }, { "path": "./plugins/search/plugin-search/tsconfig.build.json" }, { "path": "./plugins/search/plugin-slimsearch/tsconfig.build.json" }, + { "path": "./plugins/search/plugin-meilisearch/tsconfig.build.json" }, // seo { "path": "./plugins/seo/plugin-seo/tsconfig.build.json" }, From 2885d194532893704f100f10f981dcc078b86e98 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Tue, 1 Apr 2025 13:28:05 +0800 Subject: [PATCH 02/46] feat: rebuild --- .../search/plugin-meilisearch/package.json | 70 ++-- .../plugin-meilisearch/rollup.config.ts | 12 + .../src/client/MeiliSearch.vue | 17 - .../src/client/components/MeiliSearch.ts | 28 ++ .../src/client/components/index.ts | 1 + .../plugin-meilisearch/src/client/config.ts | 20 ++ .../plugin-meilisearch/src/client/define.ts | 137 -------- .../plugin-meilisearch/src/client/index.ts | 11 - .../plugin-meilisearch/src/client/shims.d.ts | 3 + .../search/plugin-meilisearch/src/index.ts | 14 - .../plugin-meilisearch/src/node/index.ts | 1 + .../src/node/meiliSearchPlugin.ts | 18 ++ .../plugin-meilisearch/src/shared/index.ts | 3 + .../plugin-meilisearch/tsconfig.build.json | 14 +- .../search/plugin-meilisearch/tsup.config.ts | 14 - pnpm-lock.yaml | 298 +----------------- 16 files changed, 130 insertions(+), 531 deletions(-) create mode 100644 plugins/search/plugin-meilisearch/rollup.config.ts delete mode 100644 plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue create mode 100644 plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts create mode 100644 plugins/search/plugin-meilisearch/src/client/components/index.ts create mode 100644 plugins/search/plugin-meilisearch/src/client/config.ts delete mode 100644 plugins/search/plugin-meilisearch/src/client/define.ts delete mode 100644 plugins/search/plugin-meilisearch/src/client/index.ts create mode 100644 plugins/search/plugin-meilisearch/src/client/shims.d.ts delete mode 100644 plugins/search/plugin-meilisearch/src/index.ts create mode 100644 plugins/search/plugin-meilisearch/src/node/index.ts create mode 100644 plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts create mode 100644 plugins/search/plugin-meilisearch/src/shared/index.ts delete mode 100644 plugins/search/plugin-meilisearch/tsup.config.ts diff --git a/plugins/search/plugin-meilisearch/package.json b/plugins/search/plugin-meilisearch/package.json index df50628a61..f6bceaca33 100644 --- a/plugins/search/plugin-meilisearch/package.json +++ b/plugins/search/plugin-meilisearch/package.json @@ -1,50 +1,50 @@ { - "name": "vuepress-plugin-meilisearch2", - "description": "Added the meilisearch search plugin to Vuepress2.x", - "version": "0.5.1", - "module": "./lib/index.js", + "name": "@vuepress/plugin-meilisearch", + "version": "2.0.0-rc.90", + "description": "VuePress plugin - built-in meilisearch", + "keywords": [ + "vuepress-plugin", + "vuepress", + "plugin", + "search", + "meilisearch" + ], + "homepage": "https://ecosystem.vuejs.press/plugins/search/meilisearch.html", + "bugs": { + "url": "https://github.com/vuepress/ecosystem/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vuepress/ecosystem.git", + "directory": "plugins/search/plugin-meilisearch" + }, + "license": "MIT", + "author": "JQiue", + "type": "module", "exports": { - ".": { - "import": "./lib/index.js" - } + ".": "./lib/node/index.js", + "./client": "./lib/client/index.js", + "./package.json": "./package.json" }, + "main": "./lib/node/index.js", + "types": "./lib/node/index.d.ts", "files": [ "lib" ], - "types": "./lib/index.d.ts", - "type": "module", "scripts": { "build": "tsc -b tsconfig.build.json", - "bundle": "tsup", - "copy": "cpx \"src/**/*.{vue,svg,js,css}\" lib" + "bundle": "rollup -c rollup.config.ts --configPlugin esbuild", + "clean": "rimraf --glob ./lib ./*.tsbuildinfo" }, - "author": "JQiue", - "repository": { - "type": "git", - "url": "git+https://github.com/JQiue/vuepress-plugin-meilisearch2.git" - }, - "bugs": { - "url": "https://github.com/JQiue/vuepress-plugin-meilisearch2/issues" - }, - "keywords": [ - "vuepress", - "vuepress-plugin", - "meilisearch", - "vuepress-next" - ], - "license": "MIT", "dependencies": { - "@vuepress/utils": "2.0.0-rc.20", - "@hyrious/esbuild-plugin-commonjs": "0.2.5", + "meilisearch": "0.49.0", "meilisearch-docsearch": "^0.7.1", "vue": "^3.5.13" }, - "devDependencies": { - "cpx2": "8.0.0", - "ts-node": "^10.9.2", - "tsconfig-vuepress": "5.2.1", - "tsup": "^8.0.2", - "typescript": "^5.4.3", - "vuepress": "2.0.0-rc.20" + "peerDependencies": { + "vuepress": "catalog:" + }, + "publishConfig": { + "access": "public" } } diff --git a/plugins/search/plugin-meilisearch/rollup.config.ts b/plugins/search/plugin-meilisearch/rollup.config.ts new file mode 100644 index 0000000000..e377928bcd --- /dev/null +++ b/plugins/search/plugin-meilisearch/rollup.config.ts @@ -0,0 +1,12 @@ +import { rollupBundle } from '../../../scripts/rollup.js' + +export default [ + ...rollupBundle('node/index', {}), + ...rollupBundle( + { base: 'client', files: ['components/MeiliSearch', 'config'] }, + { + external: ['meilisearch-docsearch', 'meilisearch-docsearch/css'], + dtsExternal: ['meilisearch-docsearch/css'], + }, + ), +] diff --git a/plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue b/plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue deleted file mode 100644 index 5fe4fac977..0000000000 --- a/plugins/search/plugin-meilisearch/src/client/MeiliSearch.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts new file mode 100644 index 0000000000..c55a9770c2 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -0,0 +1,28 @@ +import { docsearch } from 'meilisearch-docsearch' +import type { PropType } from 'vue' +import { defineComponent, h, onMounted } from 'vue' + +import type { MeiliSearchDocSearchOptions } from '../../shared/index.js' + +import 'meilisearch-docsearch/css' + +export const MeiliSearch = defineComponent({ + name: 'MeiliSearch', + props: { + options: { + type: Object as PropType, + required: true, + }, + }, + + setup(props) { + onMounted(() => { + docsearch({ + container: '#docsearch', + ...props.options, + }) + }) + + return () => h('div', { id: 'docsearch' }) + }, +}) diff --git a/plugins/search/plugin-meilisearch/src/client/components/index.ts b/plugins/search/plugin-meilisearch/src/client/components/index.ts new file mode 100644 index 0000000000..852bcd2d40 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/components/index.ts @@ -0,0 +1 @@ +export * from './MeiliSearch.js' diff --git a/plugins/search/plugin-meilisearch/src/client/config.ts b/plugins/search/plugin-meilisearch/src/client/config.ts new file mode 100644 index 0000000000..5bc71624bd --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/config.ts @@ -0,0 +1,20 @@ +import { defineAsyncComponent, h } from 'vue' +import { defineClientConfig } from 'vuepress/client' +import type { MeiliSearchDocSearchOptions } from '../shared/index.js' + +declare const __MM_SEARCH__: MeiliSearchDocSearchOptions + +export default defineClientConfig({ + enhance({ app }) { + app.component( + 'SearchBox', + defineAsyncComponent(() => + import('./components/index.js').then( + ({ MeiliSearch }) => + () => + h(MeiliSearch, { options: __MM_SEARCH__ }), + ), + ), + ) + }, +}) diff --git a/plugins/search/plugin-meilisearch/src/client/define.ts b/plugins/search/plugin-meilisearch/src/client/define.ts deleted file mode 100644 index 0eaa03d019..0000000000 --- a/plugins/search/plugin-meilisearch/src/client/define.ts +++ /dev/null @@ -1,137 +0,0 @@ -type DocSearchHotKeys = string[] | false - -interface Query { - q?: string | null -} - -interface Pagination { - offset?: number - limit?: number -} - -interface Highlight { - attributesToHighlight?: string[] - highlightPreTag?: string - highlightPostTag?: string -} - -interface Crop { - attributesToCrop?: string[] - cropLength?: number - cropMarker?: string -} - -type Filter = (string[] | string)[] | string - -type Locale = string - -interface HybridSearch { - embedder?: string - semanticRatio?: number -} - -const MatchingStrategies = { - ALL: 'all', - LAST: 'last', - FREQUENCY: 'frequency', -} as const - -type MatchingStrategies = - (typeof MatchingStrategies)[keyof typeof MatchingStrategies] - -type SearchParams = Crop & - Highlight & - Pagination & - Query & { - filter?: Filter - sort?: string[] - facets?: string[] - attributesToRetrieve?: string[] - showMatchesPosition?: boolean - matchingStrategy?: MatchingStrategies - hitsPerPage?: number - page?: number - facetName?: string - facetQuery?: string - vector?: number[] | null - showRankingScore?: boolean - showRankingScoreDetails?: boolean - rankingScoreThreshold?: number - attributesToSearchOn?: string[] | null - hybrid?: HybridSearch - distinct?: string - retrieveVectors?: boolean - locales?: Locale[] - } - -export interface DocSearchProps { - host: string - apiKey: string - indexUid: string - clientAgents?: string[] - /** - * An array of hotkeys to trigger the search modal. - * Can be either a single character, for example `s` or `/`, - * or a combination of modifiers and key, for example `ctrl+k`. - * - * Default keys are `['ctrl+k', 's', '/']` - * - * Set to `false` to disable default keys. - */ - hotKeys?: DocSearchHotKeys - translations?: DocSearchTranslations - searchParams?: SearchParams - environment?: typeof window - /** - * Duration to wait between keystores to determine whether a search should happen or not. - * Defaults to `200`. - * - * Set to `false` to disable debouncing. - * - * This is an optimization that discards unnecessary search operations, for example, - * if a user is typing `hello`, we skip search operations for `h`, `he`, `hel` and `hell` - * as this usually not what the user wants to search for, and instead wait a few milliseconds until - * the user stops typing for a brief moment, and then we do the search operation. - * In the previous example, that would be `hello`. - */ - debounceDuration?: number | false -} - -type ButtonTranslations = Partial<{ - buttonText: string - buttonAriaLabel: string -}> - -type FooterTranslations = Partial<{ - selectText: string - selectKeyAriaLabel: string - navigateText: string - navigateUpKeyAriaLabel: string - navigateDownKeyAriaLabel: string - closeText: string - closeKeyAriaLabel: string - poweredByText: string -}> - -type SearchBoxTranslations = Partial<{ - searchDocsPlaceHolder: string - resetButtonTitle: string - resetButtonAriaLabel: string - cancelButtonText: string - cancelButtonAriaLabel: string -}> - -type ModalTranslations = FooterTranslations & - Partial<{ - linkToTheResultAriaLabel: string - }> & - SearchBoxTranslations - -type DocSearchTranslations = Partial<{ - button: ButtonTranslations - modal: ModalTranslations -}> - -declare const OPTIONS: DocSearchProps - -export const pluginOptions = OPTIONS diff --git a/plugins/search/plugin-meilisearch/src/client/index.ts b/plugins/search/plugin-meilisearch/src/client/index.ts deleted file mode 100644 index f24370fcaa..0000000000 --- a/plugins/search/plugin-meilisearch/src/client/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { defineAsyncComponent } from 'vue' -import { defineClientConfig } from 'vuepress/client' - -export default defineClientConfig({ - enhance({ app }) { - app.component( - 'SearchBox', - defineAsyncComponent(() => import('./MeiliSearch.vue')), - ) - }, -}) diff --git a/plugins/search/plugin-meilisearch/src/client/shims.d.ts b/plugins/search/plugin-meilisearch/src/client/shims.d.ts new file mode 100644 index 0000000000..214f01e1d4 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/shims.d.ts @@ -0,0 +1,3 @@ +declare module 'meilisearch-docsearch/css' { + export {} +} diff --git a/plugins/search/plugin-meilisearch/src/index.ts b/plugins/search/plugin-meilisearch/src/index.ts deleted file mode 100644 index 2a52d307e0..0000000000 --- a/plugins/search/plugin-meilisearch/src/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { getDirname, path } from '@vuepress/utils' -import type { DocSearchProps } from './client/define' - -const __dirname = getDirname(import.meta.url) - -export const MeiliSearchPlugin = (options: DocSearchProps) => { - return { - name: 'vuepress-plugin-meilisearch', - clientConfigFile: path.resolve(__dirname, './client/index.js'), - define: { - OPTIONS: options, - }, - } -} diff --git a/plugins/search/plugin-meilisearch/src/node/index.ts b/plugins/search/plugin-meilisearch/src/node/index.ts new file mode 100644 index 0000000000..0c805d7614 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/node/index.ts @@ -0,0 +1 @@ +export * from './meiliSearchPlugin.js' diff --git a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts new file mode 100644 index 0000000000..7ac78b9a5b --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts @@ -0,0 +1,18 @@ +import type { Plugin } from 'vuepress' +import { getDirname, path } from 'vuepress/utils' + +import type { MeiliSearchDocSearchOptions } from '../shared' + +const __dirname = getDirname(import.meta.url) + +export const meiliSearchPlugin = ( + options: MeiliSearchDocSearchOptions, +): Plugin => ({ + name: '@vuepress/plugin-meilisearch', + + define: { + __MM_SEARCH__: options, + }, + + clientConfigFile: path.resolve(__dirname, '../client/config.js'), +}) diff --git a/plugins/search/plugin-meilisearch/src/shared/index.ts b/plugins/search/plugin-meilisearch/src/shared/index.ts new file mode 100644 index 0000000000..3d24d73504 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/shared/index.ts @@ -0,0 +1,3 @@ +import type { DocSearchOptions } from 'meilisearch-docsearch' + +export type MeiliSearchDocSearchOptions = Omit diff --git a/plugins/search/plugin-meilisearch/tsconfig.build.json b/plugins/search/plugin-meilisearch/tsconfig.build.json index c5f921ae5d..7149386567 100644 --- a/plugins/search/plugin-meilisearch/tsconfig.build.json +++ b/plugins/search/plugin-meilisearch/tsconfig.build.json @@ -1,15 +1,9 @@ { "extends": "../../../tsconfig.build.json", "compilerOptions": { - "lib": ["DOM", "ES2022"], - "module": "ESNext", - "moduleResolution": "Bundler", - "skipLibCheck": true, - "target": "ES2022", - "types": ["vuepress/client-types"], - "verbatimModuleSyntax": true, - "noEmit": true, - "allowImportingTsExtensions": true + "rootDir": "./src", + "outDir": "./lib", + "types": ["vuepress/client-types", "vite/client", "webpack-env"] }, - "include": ["./src/**/*"] + "include": ["./src"] } diff --git a/plugins/search/plugin-meilisearch/tsup.config.ts b/plugins/search/plugin-meilisearch/tsup.config.ts deleted file mode 100644 index cc5baba19c..0000000000 --- a/plugins/search/plugin-meilisearch/tsup.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { commonjs } from '@hyrious/esbuild-plugin-commonjs' -import { defineConfig } from 'tsup' - -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/index.ts', 'src/client/index.ts', 'src/client/define.ts'], - esbuildPlugins: [commonjs()], - - format: ['esm'], - outDir: 'lib', - external: [/\.vue$/u, /^@internal/u], - target: 'node20', -}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c7837fd287..b6f8e244a8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1066,37 +1066,19 @@ importers: plugins/search/plugin-meilisearch: dependencies: - '@hyrious/esbuild-plugin-commonjs': - specifier: 0.2.5 - version: 0.2.5(esbuild@0.25.1) - '@vuepress/utils': - specifier: 2.0.0-rc.20 - version: 2.0.0-rc.20 meilisearch-docsearch: specifier: ^0.7.1 version: 0.7.1 vue: specifier: ^3.5.13 version: 3.5.13(typescript@5.8.2) - devDependencies: - cpx2: - specifier: 8.0.0 - version: 8.0.0 - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@22.13.14)(typescript@5.8.2) - tsconfig-vuepress: - specifier: 5.2.1 - version: 5.2.1 - tsup: - specifier: ^8.0.2 - version: 8.4.0(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0) - typescript: - specifier: ^5.4.3 - version: 5.8.2 vuepress: - specifier: 2.0.0-rc.20 + specifier: 'catalog:' version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.1)(typescript@5.8.2))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)) + devDependencies: + meilisearch: + specifier: 0.49.0 + version: 0.49.0 plugins/search/plugin-search: dependencies: @@ -2079,10 +2061,6 @@ packages: conventional-commits-parser: optional: true - '@cspotcode/source-map-support@0.8.1': - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - '@csstools/css-parser-algorithms@3.0.4': resolution: {integrity: sha512-Up7rBoV77rv29d3uKHUIVubz1BTcgyUK72IvCQAbfbMv584xHcGKCKbWh7i8hPrRJ7qU4Y8IO3IY9m+iTB7P3A==} engines: {node: '>=18'} @@ -2362,16 +2340,6 @@ packages: resolution: {integrity: sha512-e5+YUKENATs1JgYHMzTr2MW/NDcXGfYFAuOQU8gJgF/kEh4EqKgfGrfLI67bMD4tbhZVlkigz/9YYwWcbOFthg==} engines: {node: '>=10.13.0'} - '@hyrious/esbuild-plugin-commonjs@0.2.5': - resolution: {integrity: sha512-6HZzvSq89ek4f5g6Iif2K5iI+8frkZl8W8y35XfkEy3jRGLfu9eXGIr36UrAH7Ux730rgwaPXL3EAcJHrLdoPA==} - engines: {node: '>=14'} - peerDependencies: - cjs-module-lexer: '*' - esbuild: ^0.25.0 - peerDependenciesMeta: - cjs-module-lexer: - optional: true - '@inquirer/checkbox@4.1.4': resolution: {integrity: sha512-d30576EZdApjAMceijXA5jDzRQHT/MygbC+J8I7EqA6f/FRpYxlRtRJbHF8gHeWYeSdOuTEJqonn7QLB1ELezA==} engines: {node: '>=18'} @@ -2537,9 +2505,6 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@jridgewell/trace-mapping@0.3.9': - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@jsonjoy.com/base64@1.1.2': resolution: {integrity: sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==} engines: {node: '>=10.0'} @@ -3346,18 +3311,6 @@ packages: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} - '@tsconfig/node10@1.0.11': - resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} - - '@tsconfig/node12@1.0.11': - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - - '@tsconfig/node14@1.0.3': - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - - '@tsconfig/node16@1.0.4': - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - '@tufjs/canonical-json@2.0.0': resolution: {integrity: sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -3898,10 +3851,6 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn-walk@8.3.4: - resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} - engines: {node: '>=0.4.0'} - acorn@8.14.1: resolution: {integrity: sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==} engines: {node: '>=0.4.0'} @@ -3965,9 +3914,6 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} - any-promise@1.3.0: - resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} - anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -3975,9 +3921,6 @@ packages: aproba@2.0.0: resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} - arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - arg@5.0.2: resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} @@ -4137,12 +4080,6 @@ packages: resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} engines: {node: '>=18'} - bundle-require@5.1.0: - resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - peerDependencies: - esbuild: ^0.25.0 - byte-size@9.0.1: resolution: {integrity: sha512-YLe9x3rabBrcI0cueCdLS2l5ONUKywcRpTs02B8KP9/Cimhj7o3ZccGrPnRvcbyHMbb7W79/3MUJl7iGgTXKEw==} engines: {node: '>=12.17'} @@ -4333,10 +4270,6 @@ packages: commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} - commander@4.1.1: - resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} - engines: {node: '>= 6'} - commander@7.2.0: resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==} engines: {node: '>= 10'} @@ -4383,10 +4316,6 @@ packages: resolution: {integrity: sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==} engines: {node: '>=0.8'} - consola@3.4.2: - resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} - engines: {node: ^14.18.0 || >=16.10.0} - console-control-strings@1.1.0: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} @@ -4530,9 +4459,6 @@ packages: engines: {node: ^20.0.0 || >=22.0.0, npm: '>=10'} hasBin: true - create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - cross-env@7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -4785,10 +4711,6 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} - diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -6000,10 +5922,6 @@ packages: resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} hasBin: true - joycon@3.1.1: - resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} - engines: {node: '>=10'} - js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -6205,10 +6123,6 @@ packages: resolution: {integrity: sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - load-tsconfig@0.2.5: - resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - loader-runner@4.3.0: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} @@ -6311,9 +6225,6 @@ packages: resolution: {integrity: sha512-G0yBotnlWVonPClw+tq+xi4K7DZC9n96HjGTBDdHkstAVsDkfZhi1sTvZypXLpyQTbISBkDtK0E5XlUqDsShQg==} engines: {node: '>=18'} - make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - make-fetch-happen@14.0.3: resolution: {integrity: sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==} engines: {node: ^18.17.0 || >=20.5.0} @@ -6655,9 +6566,6 @@ packages: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} - mz@2.7.0: - resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} - nano-staged@0.8.0: resolution: {integrity: sha512-QSEqPGTCJbkHU2yLvfY6huqYPjdBrOaTMKatO1F8nCSrkQGXeKwtCiCnsdxnuMhbg3DTVywKaeWLGCE5oJpq0g==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -6773,10 +6681,6 @@ packages: nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} - object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} @@ -7028,10 +6932,6 @@ packages: resolution: {integrity: sha512-KocF8ve28eFjjuBKKGvzOBGzG8ew2OqOOSxTTZhirkzH7h3BI1vyzqlR0qbfcDBve1Yzo3FVlWUAtCRrbVN8Fw==} engines: {node: '>=14.16'} - pirates@4.0.7: - resolution: {integrity: sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==} - engines: {node: '>= 6'} - pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -8187,11 +8087,6 @@ packages: subarg@1.0.0: resolution: {integrity: sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg==} - sucrase@3.35.0: - resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} - engines: {node: '>=16 || 14 >=14.17'} - hasBin: true - superjson@2.2.2: resolution: {integrity: sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q==} engines: {node: '>=16'} @@ -8289,13 +8184,6 @@ packages: resolution: {integrity: sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==} engines: {node: '>=8'} - thenify-all@1.6.0: - resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} - engines: {node: '>=0.8'} - - thenify@3.3.1: - resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} - thingies@1.21.0: resolution: {integrity: sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g==} engines: {node: '>=10.18'} @@ -8351,10 +8239,6 @@ packages: peerDependencies: tslib: '2' - tree-kill@1.2.2: - resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} - hasBin: true - treeverse@3.0.0: resolution: {integrity: sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -8371,48 +8255,12 @@ packages: ts-debounce@4.0.0: resolution: {integrity: sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg==} - ts-interface-checker@0.1.13: - resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} - - ts-node@10.9.2: - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - tsconfig-vuepress@5.2.1: resolution: {integrity: sha512-9JI4bozH9ISFRj0KIbSTpyk6Metl7rcICnCFcvdgWj+Hx4L8Z/VuWbAdgzNysiMafILfBLJrfsViEj6ZeW6fHQ==} tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - tsup@8.4.0: - resolution: {integrity: sha512-b+eZbPCjz10fRryaAA7C8xlIHnf8VnsaRqydheLIqwG/Mcpfk8Z5zp3HayX7GaTygkigHl5cBUs+IhcySiIexQ==} - engines: {node: '>=18'} - hasBin: true - peerDependencies: - '@microsoft/api-extractor': ^7.36.0 - '@swc/core': ^1 - postcss: ^8.4.12 - typescript: '>=4.5.0' - peerDependenciesMeta: - '@microsoft/api-extractor': - optional: true - '@swc/core': - optional: true - postcss: - optional: true - typescript: - optional: true - tsx@4.19.3: resolution: {integrity: sha512-4H8vUNGNjQ4V2EOoGw005+c+dGuPSnhpPBPHBtsZdGZBk/iJb4kguGlPWaZTZ3q5nMtFOEsY0nRDlh9PJyd6SQ==} engines: {node: '>=18.0.0'} @@ -8620,9 +8468,6 @@ packages: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true - v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -9038,10 +8883,6 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} - yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -9946,10 +9787,6 @@ snapshots: conventional-commits-filter: 5.0.0 conventional-commits-parser: 6.1.0 - '@cspotcode/source-map-support@0.8.1': - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - '@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3)': dependencies: '@csstools/css-tokenizer': 3.0.3 @@ -10151,10 +9988,6 @@ snapshots: '@hutson/parse-repository-url@5.0.0': {} - '@hyrious/esbuild-plugin-commonjs@0.2.5(esbuild@0.25.1)': - dependencies: - esbuild: 0.25.1 - '@inquirer/checkbox@4.1.4(@types/node@22.13.14)': dependencies: '@inquirer/core': 10.1.9(@types/node@22.13.14) @@ -10323,11 +10156,6 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@jridgewell/trace-mapping@0.3.9': - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 - '@jsonjoy.com/base64@1.1.2(tslib@2.8.1)': dependencies: tslib: 2.8.1 @@ -11247,14 +11075,6 @@ snapshots: '@trysound/sax@0.2.0': {} - '@tsconfig/node10@1.0.11': {} - - '@tsconfig/node12@1.0.11': {} - - '@tsconfig/node14@1.0.3': {} - - '@tsconfig/node16@1.0.4': {} - '@tufjs/canonical-json@2.0.0': {} '@tufjs/models@3.0.1': @@ -12037,10 +11857,6 @@ snapshots: dependencies: acorn: 8.14.1 - acorn-walk@8.3.4: - dependencies: - acorn: 8.14.1 - acorn@8.14.1: {} add-stream@1.0.0: {} @@ -12104,8 +11920,6 @@ snapshots: ansi-styles@6.2.1: {} - any-promise@1.3.0: {} - anymatch@3.1.3: dependencies: normalize-path: 3.0.0 @@ -12113,8 +11927,6 @@ snapshots: aproba@2.0.0: {} - arg@4.1.3: {} - arg@5.0.2: {} argparse@1.0.10: @@ -12287,11 +12099,6 @@ snapshots: dependencies: run-applescript: 7.0.0 - bundle-require@5.1.0(esbuild@0.25.1): - dependencies: - esbuild: 0.25.1 - load-tsconfig: 0.2.5 - byte-size@9.0.1: {} bytes@3.1.2: {} @@ -12486,8 +12293,6 @@ snapshots: commander@2.20.3: {} - commander@4.1.1: {} - commander@7.2.0: {} commander@8.3.0: {} @@ -12532,8 +12337,6 @@ snapshots: connect-history-api-fallback@2.0.0: {} - consola@3.4.2: {} - console-control-strings@1.1.0: {} content-disposition@0.5.4: @@ -12697,8 +12500,6 @@ snapshots: transitivePeerDependencies: - supports-color - create-require@1.1.1: {} - cross-env@7.0.3: dependencies: cross-spawn: 7.0.6 @@ -12928,8 +12729,6 @@ snapshots: dependencies: dequal: 2.0.3 - diff@4.0.2: {} - dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -14337,8 +14136,6 @@ snapshots: jiti@2.4.2: {} - joycon@3.1.1: {} - js-tokens@4.0.0: {} js-tokens@9.0.1: {} @@ -14509,8 +14306,6 @@ snapshots: load-json-file@7.0.1: {} - load-tsconfig@0.2.5: {} - loader-runner@4.3.0: {} loader-utils@2.0.4: @@ -14600,8 +14395,6 @@ snapshots: make-dir@5.0.0: {} - make-error@1.3.6: {} - make-fetch-happen@14.0.3: dependencies: '@npmcli/agent': 3.0.0 @@ -15077,12 +14870,6 @@ snapshots: mute-stream@2.0.0: {} - mz@2.7.0: - dependencies: - any-promise: 1.3.0 - object-assign: 4.1.1 - thenify-all: 1.6.0 - nano-staged@0.8.0: dependencies: picocolors: 1.1.1 @@ -15206,8 +14993,6 @@ snapshots: dependencies: boolbase: 1.0.0 - object-assign@4.1.1: {} - object-inspect@1.13.4: {} object-keys@1.1.1: {} @@ -15475,8 +15260,6 @@ snapshots: pify@6.1.0: {} - pirates@4.0.7: {} - pkg-dir@4.2.0: dependencies: find-up: 4.1.0 @@ -16700,16 +16483,6 @@ snapshots: dependencies: minimist: 1.2.8 - sucrase@3.35.0: - dependencies: - '@jridgewell/gen-mapping': 0.3.8 - commander: 4.1.1 - glob: 10.4.5 - lines-and-columns: 1.2.4 - mz: 2.7.0 - pirates: 4.0.7 - ts-interface-checker: 0.1.13 - superjson@2.2.2: dependencies: copy-anything: 3.0.5 @@ -16817,14 +16590,6 @@ snapshots: text-extensions@2.4.0: {} - thenify-all@1.6.0: - dependencies: - thenify: 3.3.1 - - thenify@3.3.1: - dependencies: - any-promise: 1.3.0 - thingies@1.21.0(tslib@2.8.1): dependencies: tslib: 2.8.1 @@ -16866,8 +16631,6 @@ snapshots: dependencies: tslib: 2.8.1 - tree-kill@1.2.2: {} - treeverse@3.0.0: {} trim-lines@3.0.1: {} @@ -16878,57 +16641,10 @@ snapshots: ts-debounce@4.0.0: {} - ts-interface-checker@0.1.13: {} - - ts-node@10.9.2(@types/node@22.13.14)(typescript@5.8.2): - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 22.13.14 - acorn: 8.14.1 - acorn-walk: 8.3.4 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.8.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - tsconfig-vuepress@5.2.1: {} tslib@2.8.1: {} - tsup@8.4.0(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0): - dependencies: - bundle-require: 5.1.0(esbuild@0.25.1) - cac: 6.7.14 - chokidar: 4.0.3 - consola: 3.4.2 - debug: 4.4.0 - esbuild: 0.25.1 - joycon: 3.1.1 - picocolors: 1.1.1 - postcss-load-config: 6.0.1(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.3)(yaml@2.7.0) - resolve-from: 5.0.0 - rollup: 4.37.0 - source-map: 0.8.0-beta.0 - sucrase: 3.35.0 - tinyexec: 0.3.2 - tinyglobby: 0.2.12 - tree-kill: 1.2.2 - optionalDependencies: - postcss: 8.5.3 - typescript: 5.8.2 - transitivePeerDependencies: - - jiti - - supports-color - - tsx - - yaml - tsx@4.19.3: dependencies: esbuild: 0.25.1 @@ -17148,8 +16864,6 @@ snapshots: uuid@8.3.2: {} - v8-compile-cache-lib@3.0.1: {} - validate-npm-package-license@3.0.4: dependencies: spdx-correct: 3.2.0 @@ -17704,8 +17418,6 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 - yn@3.1.1: {} - yocto-queue@0.1.0: {} yocto-queue@1.2.1: {} From d245da006a5dd933e4b39b276e7ec441457b5498 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Tue, 1 Apr 2025 13:31:30 +0800 Subject: [PATCH 03/46] chore: tweaks --- plugins/search/plugin-meilisearch/src/node/index.ts | 1 + .../search/plugin-meilisearch/src/node/meiliSearchPlugin.ts | 4 ++-- plugins/search/plugin-meilisearch/src/node/option.ts | 3 +++ plugins/search/plugin-meilisearch/src/shared/index.ts | 5 ++++- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 plugins/search/plugin-meilisearch/src/node/option.ts diff --git a/plugins/search/plugin-meilisearch/src/node/index.ts b/plugins/search/plugin-meilisearch/src/node/index.ts index 0c805d7614..11df646f9e 100644 --- a/plugins/search/plugin-meilisearch/src/node/index.ts +++ b/plugins/search/plugin-meilisearch/src/node/index.ts @@ -1 +1,2 @@ export * from './meiliSearchPlugin.js' +export type * from './option.js' diff --git a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts index 7ac78b9a5b..4a4ec42fce 100644 --- a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts +++ b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts @@ -1,12 +1,12 @@ import type { Plugin } from 'vuepress' import { getDirname, path } from 'vuepress/utils' -import type { MeiliSearchDocSearchOptions } from '../shared' +import type { MeiliSearchPluginOptions } from './option.js' const __dirname = getDirname(import.meta.url) export const meiliSearchPlugin = ( - options: MeiliSearchDocSearchOptions, + options: MeiliSearchPluginOptions, ): Plugin => ({ name: '@vuepress/plugin-meilisearch', diff --git a/plugins/search/plugin-meilisearch/src/node/option.ts b/plugins/search/plugin-meilisearch/src/node/option.ts new file mode 100644 index 0000000000..dd3d1d015b --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/node/option.ts @@ -0,0 +1,3 @@ +import type { MeiliSearchDocSearchOptions } from '../shared/index.js' + +export type MeiliSearchPluginOptions = MeiliSearchDocSearchOptions diff --git a/plugins/search/plugin-meilisearch/src/shared/index.ts b/plugins/search/plugin-meilisearch/src/shared/index.ts index 3d24d73504..8b0a480486 100644 --- a/plugins/search/plugin-meilisearch/src/shared/index.ts +++ b/plugins/search/plugin-meilisearch/src/shared/index.ts @@ -1,3 +1,6 @@ import type { DocSearchOptions } from 'meilisearch-docsearch' -export type MeiliSearchDocSearchOptions = Omit +export type MeiliSearchDocSearchOptions = Omit< + DocSearchOptions, + 'container' | 'environment' +> From 6a989ec6de9605adcd357d6a18ea8594d8c767e0 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Tue, 1 Apr 2025 13:33:56 +0800 Subject: [PATCH 04/46] chore: tweaks --- .../src/client/components/MeiliSearch.ts | 5 +++-- .../plugin-meilisearch/src/client/config.ts | 15 ++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index c55a9770c2..fcab6ec434 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -1,4 +1,3 @@ -import { docsearch } from 'meilisearch-docsearch' import type { PropType } from 'vue' import { defineComponent, h, onMounted } from 'vue' @@ -16,7 +15,9 @@ export const MeiliSearch = defineComponent({ }, setup(props) { - onMounted(() => { + onMounted(async () => { + const { docsearch } = await import('meilisearch-docsearch') + docsearch({ container: '#docsearch', ...props.options, diff --git a/plugins/search/plugin-meilisearch/src/client/config.ts b/plugins/search/plugin-meilisearch/src/client/config.ts index 5bc71624bd..97cbccf918 100644 --- a/plugins/search/plugin-meilisearch/src/client/config.ts +++ b/plugins/search/plugin-meilisearch/src/client/config.ts @@ -1,20 +1,13 @@ -import { defineAsyncComponent, h } from 'vue' +import { h } from 'vue' import { defineClientConfig } from 'vuepress/client' + import type { MeiliSearchDocSearchOptions } from '../shared/index.js' +import { MeiliSearch } from './components/index.js' declare const __MM_SEARCH__: MeiliSearchDocSearchOptions export default defineClientConfig({ enhance({ app }) { - app.component( - 'SearchBox', - defineAsyncComponent(() => - import('./components/index.js').then( - ({ MeiliSearch }) => - () => - h(MeiliSearch, { options: __MM_SEARCH__ }), - ), - ), - ) + app.component('SearchBox', () => h(MeiliSearch, { options: __MM_SEARCH__ })) }, }) From 906d524bf9c36a705c0844e2ffe1346c04fff7dd Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Tue, 1 Apr 2025 13:37:56 +0800 Subject: [PATCH 05/46] chore: fix lockfile --- pnpm-lock.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6f8e244a8..116285a872 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1066,6 +1066,9 @@ importers: plugins/search/plugin-meilisearch: dependencies: + meilisearch: + specifier: 0.49.0 + version: 0.49.0 meilisearch-docsearch: specifier: ^0.7.1 version: 0.7.1 @@ -1075,10 +1078,6 @@ importers: vuepress: specifier: 'catalog:' version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.1)(typescript@5.8.2))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)) - devDependencies: - meilisearch: - specifier: 0.49.0 - version: 0.49.0 plugins/search/plugin-search: dependencies: From 2fb58006e75792e7265ab1e7d9a19c5a6728634e Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Tue, 1 Apr 2025 13:38:30 +0800 Subject: [PATCH 06/46] chore: tweaks --- tsconfig.build.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.build.json b/tsconfig.build.json index b1d49b5a1c..a8aad6151b 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -85,9 +85,9 @@ // search { "path": "./plugins/search/plugin-docsearch/tsconfig.build.json" }, + { "path": "./plugins/search/plugin-meilisearch/tsconfig.build.json" }, { "path": "./plugins/search/plugin-search/tsconfig.build.json" }, { "path": "./plugins/search/plugin-slimsearch/tsconfig.build.json" }, - { "path": "./plugins/search/plugin-meilisearch/tsconfig.build.json" }, // seo { "path": "./plugins/seo/plugin-seo/tsconfig.build.json" }, From dec171e4242650f60c51ca0d9c7e72179ee31ba8 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Tue, 1 Apr 2025 13:40:12 +0800 Subject: [PATCH 07/46] chore: tweaks --- .../plugin-meilisearch/src/client/components/MeiliSearch.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index fcab6ec434..a1f2e6a94c 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -7,6 +7,7 @@ import 'meilisearch-docsearch/css' export const MeiliSearch = defineComponent({ name: 'MeiliSearch', + props: { options: { type: Object as PropType, From 457cc8db728a86d8a5b14c7fa3b19d292c3b4c68 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Tue, 1 Apr 2025 16:41:03 +0800 Subject: [PATCH 08/46] feat(plugin-meilisearch): add prerender for button --- .../src/client/components/MeiliSearch.ts | 25 ++++++++++++++++--- .../src/node/meiliSearchPlugin.ts | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index a1f2e6a94c..cd512afa06 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -1,5 +1,5 @@ import type { PropType } from 'vue' -import { defineComponent, h, onMounted } from 'vue' +import { defineComponent, h, onMounted, ref } from 'vue' import type { MeiliSearchDocSearchOptions } from '../../shared/index.js' @@ -16,15 +16,34 @@ export const MeiliSearch = defineComponent({ }, setup(props) { - onMounted(async () => { + const hasInitialized = ref(false) + + const initialize = async (): Promise => { const { docsearch } = await import('meilisearch-docsearch') docsearch({ container: '#docsearch', ...props.options, }) + + hasInitialized.value = true + } + + onMounted(() => { + void initialize() }) - return () => h('div', { id: 'docsearch' }) + return () => [ + h('div', { + id: 'docsearch', + style: { display: hasInitialized.value ? 'block' : 'none' }, + }), + hasInitialized.value + ? null + : h('div', { + innerHTML: + '', + }), + ] }, }) diff --git a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts index 4a4ec42fce..ca894d7a25 100644 --- a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts +++ b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts @@ -5,7 +5,7 @@ import type { MeiliSearchPluginOptions } from './option.js' const __dirname = getDirname(import.meta.url) -export const meiliSearchPlugin = ( +export const MeiliSearchPlugin = ( options: MeiliSearchPluginOptions, ): Plugin => ({ name: '@vuepress/plugin-meilisearch', From fd2440445fdda4a58fad440a1a2365236affd90d Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Tue, 1 Apr 2025 16:58:18 +0800 Subject: [PATCH 09/46] chore: rename export function name --- plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts index ca894d7a25..4a4ec42fce 100644 --- a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts +++ b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts @@ -5,7 +5,7 @@ import type { MeiliSearchPluginOptions } from './option.js' const __dirname = getDirname(import.meta.url) -export const MeiliSearchPlugin = ( +export const meiliSearchPlugin = ( options: MeiliSearchPluginOptions, ): Plugin => ({ name: '@vuepress/plugin-meilisearch', From eba85f6518befbe4833c8d065d6510f6900357bb Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Tue, 1 Apr 2025 16:59:59 +0800 Subject: [PATCH 10/46] docs: add meilisearch docs --- docs/plugins/search/meilisearch.md | 108 ++++++++++++++++++++++++++ docs/zh/plugins/search/meilisearch.md | 108 ++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 docs/plugins/search/meilisearch.md create mode 100644 docs/zh/plugins/search/meilisearch.md diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md new file mode 100644 index 0000000000..d3a206b2b7 --- /dev/null +++ b/docs/plugins/search/meilisearch.md @@ -0,0 +1,108 @@ +--- +icon: https://docsearch.algolia.com/img/favicon.ico +--- + +# meilisearch + + + +Integrate [MeiliSearch](https://www.meilisearch.com/) into VuePress, which can provide search to your documentation site. + +## Usage + +```bash +npm i -D @vuepress/plugin-meilisearch@next +``` + +```ts +import { MeiliSearchPlugin } from 'vuepress-plugin-meilisearch2' + +export default { + plugins: [ + meilisearchPlugin({ + // Configuration options + host: '', + apiKey: '', + indexUid: '', + }), + ], +} +``` + +## Options + +### host + +- Type: `string` + +- Required: `true` + +- Details: + + Provide the HTTP address of the MeiliSearch API + +### apiKey + +- Type: `string` + +- Required: `true` + +- Details: + + API key generated by MeiliSearch + +### indexUid + +- Type: `string` + +- Required: `true` + +- Details: + + Specify the index name used for searching + +### translations + +- Type: `DocSearchTranslations` + +- Required: `false` + +- Details: + + button and modal + +### hotKeys + +- Type: `false | string[]` + +- Required: `false` + +- Details: + + Default keys are `['ctrl+k', 's', '/']`, Set to `false` to disable default keys. + +### debounceDuration + +- Type: `number | false` + +- Required: `false` + +- Details: + +- Duration to wait between keystores to determine whether a search should happen or not. Defaults to `200`. Set to `false` to disable debouncing. + +### searchParams + +- Type: `SearchParams` + +- Required: `false` + +- Details: + + - `limit(number)` - Maximum number of documents returned per query, default is `20` + - `offset(number)` - Starting offset for search results, default is `0` + - [more](https://www.meilisearch.com/docs/reference/api/search#search-parameters) + +## Components + +- SearchBox diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md new file mode 100644 index 0000000000..072d6057f9 --- /dev/null +++ b/docs/zh/plugins/search/meilisearch.md @@ -0,0 +1,108 @@ +--- +icon: https://docsearch.algolia.com/img/favicon.ico +--- + +# meilisearch + + + +将 [MeiliSearch](https://www.meilisearch.com/) 集成到 VuePress 中,为你的文档网站提供搜索功能。 + +## 使用方法 + +```bash +npm i -D @vuepress/plugin-meilisearch@next +``` + +```ts +import { meilisearchPlugin } from '@vuepress/plugin-meilisearch' + +export default { + plugins: [ + meilisearchPlugin({ + // 配置项 + host: '', + apiKey: '', + indexUid: '', + }), + ], +} +``` + +## 选项 + +### host + +- 类型:`string` + +- 是否必需:`true` + +- 详情: + + 提供 MeiliSearch API 的 HTTP 地址 + +### apiKey + +- 类型:`string` + +- 是否必需:`true` + +- 详情: + + MeiliSearch 生成的 API 密钥 + +### indexUid + +- 类型:`string` + +- 是否必需:`true` + +- 详情: + + 指定用于搜索的索引名称 + +### translations + +- 类型:`DocSearchTranslations` + +- 是否必需:`false` + +- 详情: + + 按钮和模态框 + +### hotKeys + +- 类型:`false | string[]` + +- 是否必需:`false` + +- 详情: + + 默认快捷键是 `['ctrl+k', 's', '/']`, 设置 `false` 禁用默认快捷键 + +### debounceDuration + +- 类型:`number | false` + +- 是否必需:`false` + +- 详情: + +- 在按键之间等待的时间,以确定是否应该进行搜索。默认为 `200`。设置为 `false` 以禁用防抖动 + +### searchParams + +- 类型:`SearchParams` + +- 是否必需:`false` + +- 详情: + + - `limit(number)` - 每个查询返回的最大文档数, 默认是 `20` + - `offset(number)` - 搜索结果的起始偏移量, 默认是 `0` + - [more](https://www.meilisearch.com/docs/reference/api/search#search-parameters) + +## 组件 + +- SearchBox From 318ed0e7bc80953d4cb5e36b12da1a420fe678be Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Tue, 1 Apr 2025 17:05:13 +0800 Subject: [PATCH 11/46] docs: update meilisearch ico and sidebar config --- docs/.vuepress/configs/sidebar/en.ts | 8 +++++++- docs/.vuepress/configs/sidebar/zh.ts | 8 +++++++- docs/plugins/search/meilisearch.md | 2 +- docs/zh/plugins/search/meilisearch.md | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/.vuepress/configs/sidebar/en.ts b/docs/.vuepress/configs/sidebar/en.ts index b7c31f1923..85626b396f 100644 --- a/docs/.vuepress/configs/sidebar/en.ts +++ b/docs/.vuepress/configs/sidebar/en.ts @@ -141,7 +141,13 @@ export const sidebarEn: SidebarOptions = { 'register-components', ], - '/plugins/search/': ['guidelines', 'docsearch', 'search', 'slimsearch'], + '/plugins/search/': [ + 'guidelines', + 'docsearch', + 'meilisearch', + 'search', + 'slimsearch', + ], '/plugins/seo/': [ { diff --git a/docs/.vuepress/configs/sidebar/zh.ts b/docs/.vuepress/configs/sidebar/zh.ts index 3e3f2822b6..48950ceb4a 100644 --- a/docs/.vuepress/configs/sidebar/zh.ts +++ b/docs/.vuepress/configs/sidebar/zh.ts @@ -141,7 +141,13 @@ export const sidebarZh: SidebarOptions = { 'register-components', ], - '/zh/plugins/search/': ['guidelines', 'docsearch', 'search', 'slimsearch'], + '/zh/plugins/search/': [ + 'guidelines', + 'docsearch', + 'meilisearch', + 'search', + 'slimsearch', + ], '/zh/plugins/seo/': [ { diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index d3a206b2b7..0fe2f8fabe 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -1,5 +1,5 @@ --- -icon: https://docsearch.algolia.com/img/favicon.ico +icon: https://www.meilisearch.com/favicon.ico --- # meilisearch diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 072d6057f9..e32eaee281 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -1,5 +1,5 @@ --- -icon: https://docsearch.algolia.com/img/favicon.ico +icon: https://www.meilisearch.com/favicon.ico --- # meilisearch From 709338b0c4add86b60b0e97c43c827f362de3c63 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Tue, 1 Apr 2025 22:12:18 +0800 Subject: [PATCH 12/46] docs: update meilisearch docs --- docs/plugins/search/meilisearch.md | 77 +++++++++++++++++++++++---- docs/zh/plugins/search/meilisearch.md | 76 +++++++++++++++++++++----- 2 files changed, 131 insertions(+), 22 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 0fe2f8fabe..7d099e0e40 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -29,6 +29,64 @@ export default { } ``` +## Self-hosting MeiliSearch + +MeiliSearch provides a server program that supports self-deployment options for users with cloud servers. To simplify the process of running MeiliSearch on the server side, you can use Docker for installation and management. + +```sh +docker pull getmeili/meilisearch:latest +``` + +On the first startup, a Master Key will be generated by default. **Do not expose this key**; it should only be used for internal server access, as it grants full operational permissions. + +```sh +docker run -it --rm \ + -p 7700:7700 \ + -v $(pwd)/meili_data:/meili_data \ + getmeili/meilisearch:v1.11 +``` + +To create an access key that only allows search operations, use the following request. The `indexes` array specifies which indexes this key can access, and `expiresAt` sets the key's expiration date. + +```sh +curl \ + -X POST 'http://localhost:7700/keys' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer MASTER_KEY' \ + --data-binary '{ + "description": "Search records key", + "actions": ["search"], + "indexes": ["YOUR_INDEX_NAME"], + "expiresAt": "2025-01-01T00:00:00Z" + }' +``` + +If successful, the response would look like this: + +```json +{ + "name": null, + "description": "Search records key", + "key": "adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213", + "uid": "b84d1be5-caa5-4752-b078-8f40be39051d", + "actions": ["search"], + "indexes": ["YOUR_INDEX_NAME"], + "expiresAt": "2025-01-01T00:00:00Z", + "createdAt": "2024-01-27T06:50:33.668329328Z", + "updatedAt": "2024-01-27T06:50:33.668329328Z" +} +``` + +This key can be exposed and used externally as needed. Enter it in your plugin options. + +```ts +meilisearchPlugin({ + host: 'YOUR_HOST', + apiKey: 'adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213', + indexUid: 'YOUR_INDEX_NAME', +}) +``` + ## Options ### host @@ -65,31 +123,29 @@ export default { - Type: `DocSearchTranslations` -- Required: `false` - - Details: - button and modal + Allows you to replace the default text in the DocSearch button and popup ### hotKeys -- Type: `false | string[]` +- Type: `string[] | false` -- Required: `false` +- Default: `['ctrl+k', 's', '/']` - Details: - Default keys are `['ctrl+k', 's', '/']`, Set to `false` to disable default keys. + An array of hotkeys to trigger the search modal. When the value is `false`, the search modal cannot be triggered with any key. ### debounceDuration - Type: `number | false` -- Required: `false` +- Default: `200` - Details: -- Duration to wait between keystores to determine whether a search should happen or not. Defaults to `200`. Set to `false` to disable debouncing. + The number of milliseconds that wait between keystrokes to determine whether a search should be performed,Setting the value here to `0` or `false` is logically equivalent. ### searchParams @@ -99,8 +155,9 @@ export default { - Details: - - `limit(number)` - Maximum number of documents returned per query, default is `20` - - `offset(number)` - Starting offset for search results, default is `0` + Parameters of MeiliSearch API. + +- Also see: - [more](https://www.meilisearch.com/docs/reference/api/search#search-parameters) ## Components diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index e32eaee281..e57d53529a 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -29,6 +29,64 @@ export default { } ``` +## Self-hosting MeiliSearch + +MeiliSearch 提供了一个服务器程序,支持使用云服务器的用户的自部署选项。为了简化在服务器端运行 MeiliSearch 的过程,您可以使用 Docker 进行安装和管理。 + +```sh +docker pull getmeili/meilisearch:latest +``` + +在第一次启动时,默认情况下将生成一个主密钥。**不要暴露此密钥**;它应该只用于内部服务器访问,因为它拥有完全的操作权限。 + +```sh +docker run -it --rm \ + -p 7700:7700 \ + -v $(pwd)/meili_data:/meili_data \ + getmeili/meilisearch:v1.11 +``` + +要创建只允许搜索操作的访问密钥,请使用以下请求。`indexes`数组指定该密钥可以访问哪些索引,`expiresAt`设置密钥的过期时间。 + +```sh +curl \ + -X POST 'http://localhost:7700/keys' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer MASTER_KEY' \ + --data-binary '{ + "description": "Search records key", + "actions": ["search"], + "indexes": ["YOUR_INDEX_NAME"], + "expiresAt": "2025-01-01T00:00:00Z" + }' +``` + +如果成功,响应将如下所示: + +```json +{ + "name": null, + "description": "Search records key", + "key": "adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213", + "uid": "b84d1be5-caa5-4752-b078-8f40be39051d", + "actions": ["search"], + "indexes": ["YOUR_INDEX_NAME"], + "expiresAt": "2025-01-01T00:00:00Z", + "createdAt": "2024-01-27T06:50:33.668329328Z", + "updatedAt": "2024-01-27T06:50:33.668329328Z" +} +``` + +该密钥可以根据需要在外部公开和使用,填入到你的插件选项中 + +```ts +meilisearchPlugin({ + host: 'YOUR_HOST', + apiKey: 'adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213', + indexUid: 'YOUR_INDEX_NAME', +}) +``` + ## 选项 ### host @@ -65,42 +123,36 @@ export default { - 类型:`DocSearchTranslations` -- 是否必需:`false` - - 详情: - 按钮和模态框 + 允许您替换 DocSearch 按钮和弹出框中的默认文本 ### hotKeys -- 类型:`false | string[]` +- 类型:`string[] |` -- 是否必需:`false` +- 默认值: `['ctrl+k', 's', '/']` - 详情: - 默认快捷键是 `['ctrl+k', 's', '/']`, 设置 `false` 禁用默认快捷键 + 触发搜索框的热键数组, 当设置 `false` 时无法用任何快捷键触发搜索框 ### debounceDuration - 类型:`number | false` -- 是否必需:`false` +- 默认值: `200` - 详情: -- 在按键之间等待的时间,以确定是否应该进行搜索。默认为 `200`。设置为 `false` 以禁用防抖动 + 在按键之间等待的毫秒数,以确定是否应该进行搜索。设置 `0` 或者 `false` 逻辑上是等效的 ### searchParams - 类型:`SearchParams` -- 是否必需:`false` - - 详情: - - `limit(number)` - 每个查询返回的最大文档数, 默认是 `20` - - `offset(number)` - 搜索结果的起始偏移量, 默认是 `0` - [more](https://www.meilisearch.com/docs/reference/api/search#search-parameters) ## 组件 From 2b05d4b0fca8699aa60ba61fe039a5247c4494f0 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 2 Apr 2025 14:51:23 +0800 Subject: [PATCH 13/46] chore: update words --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 45ab58a9cf..cc2e8c3493 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -52,6 +52,7 @@ "mathjax", "mdast", "mdit", + "meilisearch", "meteorlxy", "mhchem", "nord", From 9e57b57e04585044cdf65ddc7d3b69bb5d7ff4b3 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 2 Apr 2025 19:47:21 +0800 Subject: [PATCH 14/46] feat: add built-in translation --- .../plugin-docsearch/src/shared/locales.ts | 5 +- .../search/plugin-meilisearch/package.json | 1 + .../src/client/components/MeiliSearch.ts | 36 +- .../plugin-meilisearch/src/client/config.ts | 15 +- .../client/utils/getSearchButtonTemplate.ts | 14 + .../src/client/utils/index.ts | 1 + .../plugin-meilisearch/src/node/index.ts | 2 +- .../plugin-meilisearch/src/node/locales.ts | 458 ++++++++++++++++++ .../src/node/meiliSearchPlugin.ts | 40 +- .../plugin-meilisearch/src/node/option.ts | 3 - .../plugin-meilisearch/src/shared/index.ts | 12 +- pnpm-lock.yaml | 5 +- tools/helper/src/shared/index.ts | 1 + tools/helper/src/shared/types.ts | 14 + 14 files changed, 578 insertions(+), 29 deletions(-) create mode 100644 plugins/search/plugin-meilisearch/src/client/utils/getSearchButtonTemplate.ts create mode 100644 plugins/search/plugin-meilisearch/src/client/utils/index.ts create mode 100644 plugins/search/plugin-meilisearch/src/node/locales.ts delete mode 100644 plugins/search/plugin-meilisearch/src/node/option.ts create mode 100644 tools/helper/src/shared/types.ts diff --git a/plugins/search/plugin-docsearch/src/shared/locales.ts b/plugins/search/plugin-docsearch/src/shared/locales.ts index fe333f50ab..ec28417fe0 100644 --- a/plugins/search/plugin-docsearch/src/shared/locales.ts +++ b/plugins/search/plugin-docsearch/src/shared/locales.ts @@ -1,8 +1,5 @@ import type { DocSearchProps } from '@docsearch/react' - -type DeepRequired = { - [P in keyof T]-?: T[P] extends object ? DeepRequired : T[P] -} +import type { DeepRequired } from '@vuepress/helper/shared' export type DocSearchLocaleData = DeepRequired< Pick diff --git a/plugins/search/plugin-meilisearch/package.json b/plugins/search/plugin-meilisearch/package.json index f6bceaca33..474b2433b9 100644 --- a/plugins/search/plugin-meilisearch/package.json +++ b/plugins/search/plugin-meilisearch/package.json @@ -37,6 +37,7 @@ "clean": "rimraf --glob ./lib ./*.tsbuildinfo" }, "dependencies": { + "@vuepress/helper": "workspace:*", "meilisearch": "0.49.0", "meilisearch-docsearch": "^0.7.1", "vue": "^3.5.13" diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index cd512afa06..ec7554c168 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -1,29 +1,54 @@ +import { useLocaleConfig } from '@vuepress/helper/client' import type { PropType } from 'vue' -import { defineComponent, h, onMounted, ref } from 'vue' +import { computed, defineComponent, h, onMounted, ref } from 'vue' +import { useRouteLocale } from 'vuepress/client' +import type { LocaleConfig } from 'vuepress/shared' -import type { MeiliSearchDocSearchOptions } from '../../shared/index.js' +import type { + MeiliSearchLocaleData, + MeiliSearchOptions, +} from '../../shared/index.js' import 'meilisearch-docsearch/css' +import { getSearchButtonTemplate } from '../utils/getSearchButtonTemplate.js' export const MeiliSearch = defineComponent({ name: 'MeiliSearch', props: { options: { - type: Object as PropType, + type: Object as PropType, required: true, }, + + locales: { + type: Object as PropType>, + default: () => ({}), + }, }, setup(props) { + const locale = useLocaleConfig(props.locales) + const routeLocale = useRouteLocale() + + const meiliSearchOptions = computed(() => { + const { locales = {}, ...rest } = props.options + + return { + ...locale.value, + ...locales[routeLocale.value], + ...rest, + } + }) + const hasInitialized = ref(false) const initialize = async (): Promise => { const { docsearch } = await import('meilisearch-docsearch') docsearch({ + ...meiliSearchOptions.value, container: '#docsearch', - ...props.options, }) hasInitialized.value = true @@ -41,8 +66,7 @@ export const MeiliSearch = defineComponent({ hasInitialized.value ? null : h('div', { - innerHTML: - '', + innerHTML: getSearchButtonTemplate(locale.value.button), }), ] }, diff --git a/plugins/search/plugin-meilisearch/src/client/config.ts b/plugins/search/plugin-meilisearch/src/client/config.ts index 97cbccf918..1828540d04 100644 --- a/plugins/search/plugin-meilisearch/src/client/config.ts +++ b/plugins/search/plugin-meilisearch/src/client/config.ts @@ -1,13 +1,22 @@ import { h } from 'vue' import { defineClientConfig } from 'vuepress/client' -import type { MeiliSearchDocSearchOptions } from '../shared/index.js' +import type { + MeiliSearchDocSearchLocaleOptions, + MeiliSearchOptions, +} from '../shared/index.js' import { MeiliSearch } from './components/index.js' -declare const __MM_SEARCH__: MeiliSearchDocSearchOptions +declare const __ML_SEARCH_OPTIONS__: MeiliSearchOptions +declare const __ML_SEARCH_LOCALES__: MeiliSearchDocSearchLocaleOptions export default defineClientConfig({ enhance({ app }) { - app.component('SearchBox', () => h(MeiliSearch, { options: __MM_SEARCH__ })) + app.component('SearchBox', () => + h(MeiliSearch, { + options: __ML_SEARCH_OPTIONS__, + locales: __ML_SEARCH_LOCALES__, + }), + ) }, }) diff --git a/plugins/search/plugin-meilisearch/src/client/utils/getSearchButtonTemplate.ts b/plugins/search/plugin-meilisearch/src/client/utils/getSearchButtonTemplate.ts new file mode 100644 index 0000000000..46327d5df2 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/utils/getSearchButtonTemplate.ts @@ -0,0 +1,14 @@ +import type { MeiliSearchLocaleData } from '../../shared/index.js' + +/** + * Get the search button template + * + * Use the same content as in @docsearch/js + * + * TODO: the meta key text should also be dynamic + */ +export const getSearchButtonTemplate = ({ + buttonText = 'Search', + buttonAriaLabel = buttonText, +}: Partial = {}): string => + `` diff --git a/plugins/search/plugin-meilisearch/src/client/utils/index.ts b/plugins/search/plugin-meilisearch/src/client/utils/index.ts new file mode 100644 index 0000000000..eec7a0261e --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/utils/index.ts @@ -0,0 +1 @@ +export * from './getSearchButtonTemplate.js' diff --git a/plugins/search/plugin-meilisearch/src/node/index.ts b/plugins/search/plugin-meilisearch/src/node/index.ts index 11df646f9e..0a9969f588 100644 --- a/plugins/search/plugin-meilisearch/src/node/index.ts +++ b/plugins/search/plugin-meilisearch/src/node/index.ts @@ -1,2 +1,2 @@ +export * from './locales.js' export * from './meiliSearchPlugin.js' -export type * from './option.js' diff --git a/plugins/search/plugin-meilisearch/src/node/locales.ts b/plugins/search/plugin-meilisearch/src/node/locales.ts new file mode 100644 index 0000000000..46b1f9b89c --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/node/locales.ts @@ -0,0 +1,458 @@ +import type { DefaultLocaleInfo } from '@vuepress/helper' +import type { MeiliSearchLocaleData } from '../shared/index.js' + +export const localeInfo: DefaultLocaleInfo = [ + // @ts-expect-error: en locale is built-in supported + [['en', 'en-US'], {}], + [ + ['zh', 'zh-CN', 'zh-Hans'], + { + button: { + buttonText: '搜索文档', + buttonAriaLabel: '搜索文档', + }, + modal: { + searchDocsPlaceHolder: '搜索文档', + resetButtonTitle: '清除查询条件', + resetButtonAriaLabel: '清除查询条件', + cancelButtonText: '取消', + cancelButtonAriaLabel: '取消', + linkToTheResultAriaLabel: '结果的链接', + selectText: '选择', + navigateText: '切换', + closeText: '关闭', + poweredByText: '提供者', + selectKeyAriaLabel: '回车键', + closeKeyAriaLabel: 'ESC 键', + navigateUpKeyAriaLabel: '上箭头', + navigateDownKeyAriaLabel: '下箭头', + }, + }, + ], + [ + ['zh-TW', 'zh-Hant'], + { + button: { + buttonText: '搜尋文件', + buttonAriaLabel: '搜尋文件', + }, + modal: { + searchDocsPlaceHolder: '搜尋文件', + resetButtonTitle: '清除查詢條件', + resetButtonAriaLabel: '清除查詢條件', + cancelButtonText: '取消', + cancelButtonAriaLabel: '取消', + linkToTheResultAriaLabel: '結果的連結', + selectText: '選擇', + navigateText: '切換', + closeText: '關閉', + poweredByText: '提供者', + selectKeyAriaLabel: '回車鍵', + closeKeyAriaLabel: 'ESC 鍵', + navigateUpKeyAriaLabel: '上箭頭', + navigateDownKeyAriaLabel: '下箭頭', + }, + }, + ], + [ + ['de', 'de-DE'], + { + button: { + buttonText: 'Durchsuchen', + buttonAriaLabel: 'Durchsuchen', + }, + modal: { + searchDocsPlaceHolder: 'Dokumente durchsuchen', + resetButtonTitle: 'Suchkriterien zurücksetzen', + resetButtonAriaLabel: 'Suchkriterien zurücksetzen', + cancelButtonText: 'Abbrechen', + cancelButtonAriaLabel: 'Abbrechen', + linkToTheResultAriaLabel: 'Link zum Ergebnis', + selectText: 'Auswählen', + navigateText: 'Navigieren', + closeText: 'Schließen', + poweredByText: 'Anbieter', + selectKeyAriaLabel: 'Eingabetaste', + closeKeyAriaLabel: 'ESC-Taste', + navigateUpKeyAriaLabel: 'Aufwärtspfeil', + navigateDownKeyAriaLabel: 'Abwärtspfeil', + }, + }, + ], + [ + ['vi', 'vi-VN'], + { + button: { + buttonText: 'Tìm kiếm', + buttonAriaLabel: 'Tìm kiếm', + }, + modal: { + searchDocsPlaceHolder: 'Tìm kiếm tài liệu', + resetButtonTitle: 'Xóa điều kiện tìm kiếm', + resetButtonAriaLabel: 'Xóa điều kiện tìm kiếm', + cancelButtonText: 'Hủy', + cancelButtonAriaLabel: 'Hủy', + linkToTheResultAriaLabel: 'Liên kết đến kết quả', + selectText: 'Chọn', + navigateText: 'Chuyển đến', + closeText: 'Đóng', + poweredByText: 'Nhà cung cấp', + selectKeyAriaLabel: 'Phím Enter', + closeKeyAriaLabel: 'Phím ESC', + navigateUpKeyAriaLabel: 'Phím mũi tên lên', + navigateDownKeyAriaLabel: 'Phím mũi tên xuống', + }, + }, + ], + [ + ['uk'], + { + button: { + buttonText: 'Пошук', + buttonAriaLabel: 'Пошук', + }, + modal: { + searchDocsPlaceHolder: 'Пошук документів', + resetButtonTitle: 'Скинути умови пошуку', + resetButtonAriaLabel: 'Скинути умови пошуку', + cancelButtonText: 'Скасувати', + cancelButtonAriaLabel: 'Скасувати', + linkToTheResultAriaLabel: 'Посилання на результат', + selectText: 'Вибрати', + navigateText: 'Перейти', + closeText: 'Закрити', + poweredByText: 'Постачальник', + selectKeyAriaLabel: 'Клавіша Enter', + closeKeyAriaLabel: 'Клавіша ESC', + navigateUpKeyAriaLabel: 'Клавіша зі стрілкою вгору', + navigateDownKeyAriaLabel: 'Клавіша зі стрілкою вниз', + }, + }, + ], + [ + ['ru', 'ru-RU'], + { + button: { + buttonText: 'Поиск', + buttonAriaLabel: 'Поиск', + }, + modal: { + searchDocsPlaceHolder: 'Поиск документов', + resetButtonTitle: 'Сбросить условия поиска', + resetButtonAriaLabel: 'Сбросить условия поиска', + cancelButtonText: 'Отмена', + cancelButtonAriaLabel: 'Отмена', + linkToTheResultAriaLabel: 'Ссылка на результат', + selectText: 'Выбрать', + navigateText: 'Перейти', + closeText: 'Закрыть', + poweredByText: 'Поставщик', + selectKeyAriaLabel: 'Клавиша Enter', + closeKeyAriaLabel: 'Клавиша ESC', + navigateUpKeyAriaLabel: 'Клавиша со стрелкой вверх', + navigateDownKeyAriaLabel: 'Клавиша со стрелкой вниз', + }, + }, + ], + [ + ['br'], + { + button: { + buttonText: 'Pesquisar', + buttonAriaLabel: 'Pesquisar', + }, + modal: { + searchDocsPlaceHolder: 'Pesquisar documentos', + resetButtonTitle: 'Limpar critérios de pesquisa', + resetButtonAriaLabel: 'Limpar critérios de pesquisa', + cancelButtonText: 'Cancelar', + cancelButtonAriaLabel: 'Cancelar', + linkToTheResultAriaLabel: 'Link para o resultado', + selectText: 'Selecionar', + navigateText: 'Navegar', + closeText: 'Fechar', + poweredByText: 'Fornecedor', + selectKeyAriaLabel: 'Tecla Enter', + closeKeyAriaLabel: 'Tecla ESC', + navigateUpKeyAriaLabel: 'Tecla de seta para cima', + navigateDownKeyAriaLabel: 'Tecla de seta para baixo', + }, + }, + ], + [ + ['pl', 'pl-PL'], + { + button: { + buttonText: 'Szukaj', + buttonAriaLabel: 'Szukaj', + }, + modal: { + searchDocsPlaceHolder: 'Szukaj dokumentów', + resetButtonTitle: 'Wyczyść kryteria wyszukiwania', + resetButtonAriaLabel: 'Wyczyść kryteria wyszukiwania', + cancelButtonText: 'Anuluj', + cancelButtonAriaLabel: 'Anuluj', + linkToTheResultAriaLabel: 'Link do wyniku', + selectText: 'Wybierz', + navigateText: 'Przejdź', + closeText: 'Zamknij', + poweredByText: 'Dostawca', + selectKeyAriaLabel: 'Klucz Enter', + closeKeyAriaLabel: 'Klucz ESC', + navigateUpKeyAriaLabel: 'Klucz strzałki w górę', + navigateDownKeyAriaLabel: 'Klucz strzałki w dół', + }, + }, + ], + [ + ['sk', 'sk-SK'], + { + button: { + buttonText: 'Hľadať', + buttonAriaLabel: 'Hľadať', + }, + modal: { + searchDocsPlaceHolder: 'Hľadať dokumenty', + resetButtonTitle: 'Vymazať kritériá vyhľadávania', + resetButtonAriaLabel: 'Vymazať kritériá vyhľadávania', + cancelButtonText: 'Zrušiť', + cancelButtonAriaLabel: 'Zrušiť', + linkToTheResultAriaLabel: 'Odkaz na výsledok', + selectText: 'Vybrať', + navigateText: 'Prejsť', + closeText: 'Zavrieť', + poweredByText: 'Poskytovateľ', + selectKeyAriaLabel: 'Kláves Enter', + closeKeyAriaLabel: 'Kláves ESC', + navigateUpKeyAriaLabel: 'Kláves so šípkou nahor', + navigateDownKeyAriaLabel: 'Kláves so šípkou nadol', + }, + }, + ], + [ + ['fr', 'fr-FR'], + { + button: { + buttonText: 'Rechercher', + buttonAriaLabel: 'Rechercher', + }, + modal: { + searchDocsPlaceHolder: 'Rechercher des documents', + resetButtonTitle: 'Réinitialiser les critères de recherche', + resetButtonAriaLabel: 'Réinitialiser les critères de recherche', + cancelButtonText: 'Annuler', + cancelButtonAriaLabel: 'Annuler', + linkToTheResultAriaLabel: 'Lien vers le résultat', + selectText: 'Sélectionner', + navigateText: 'Naviguer', + closeText: 'Fermer', + poweredByText: 'Fournisseur', + selectKeyAriaLabel: 'Touche Entrée', + closeKeyAriaLabel: 'Touche Échap', + navigateUpKeyAriaLabel: 'Touche flèche vers le haut', + navigateDownKeyAriaLabel: 'Touche flèche vers le bas', + }, + }, + ], + [ + ['es', 'es-ES'], + { + button: { + buttonText: 'Buscar', + buttonAriaLabel: 'Buscar', + }, + modal: { + searchDocsPlaceHolder: 'Buscar documentos', + resetButtonTitle: 'Restablecer criterios de búsqueda', + resetButtonAriaLabel: 'Restablecer criterios de búsqueda', + cancelButtonText: 'Cancelar', + cancelButtonAriaLabel: 'Cancelar', + linkToTheResultAriaLabel: 'Enlace al resultado', + selectText: 'Seleccionar', + navigateText: 'Navegar', + closeText: 'Cerrar', + poweredByText: 'Proveedor', + selectKeyAriaLabel: 'Tecla Enter', + closeKeyAriaLabel: 'Tecla ESC', + navigateUpKeyAriaLabel: 'Tecla de flecha hacia arriba', + navigateDownKeyAriaLabel: 'Tecla de flecha hacia abajo', + }, + }, + ], + [ + ['ja', 'ja-JP'], + { + button: { + buttonText: '検索', + buttonAriaLabel: '検索', + }, + modal: { + searchDocsPlaceHolder: 'ドキュメントを検索', + resetButtonTitle: '検索条件をリセット', + resetButtonAriaLabel: '検索条件をリセット', + cancelButtonText: 'キャンセル', + cancelButtonAriaLabel: 'キャンセル', + linkToTheResultAriaLabel: '結果へのリンク', + selectText: '選択', + navigateText: '移動', + closeText: '閉じる', + poweredByText: 'プロバイダー', + selectKeyAriaLabel: 'Enterキー', + closeKeyAriaLabel: 'ESCキー', + navigateUpKeyAriaLabel: '上矢印キー', + navigateDownKeyAriaLabel: '下矢印キー', + }, + }, + ], + [ + ['tr', 'tr-TR'], + { + button: { + buttonText: 'Ara', + buttonAriaLabel: 'Ara', + }, + modal: { + searchDocsPlaceHolder: 'Belgeleri ara', + resetButtonTitle: 'Arama kriterlerini sıfırla', + resetButtonAriaLabel: 'Arama kriterlerini sıfırla', + cancelButtonText: 'İptal', + cancelButtonAriaLabel: 'İptal', + linkToTheResultAriaLabel: 'Sonuca bağlantı', + selectText: 'Seç', + navigateText: 'Gezin', + closeText: 'Kapat', + poweredByText: 'Sağlayıcı', + selectKeyAriaLabel: 'Enter tuşu', + closeKeyAriaLabel: 'ESC tuşu', + navigateUpKeyAriaLabel: 'Yukarı ok tuşu', + navigateDownKeyAriaLabel: 'Aşağı ok tuşu', + }, + }, + ], + [ + ['ko', 'ko-KO'], + { + button: { + buttonText: '검색', + buttonAriaLabel: '검색', + }, + modal: { + searchDocsPlaceHolder: '문서 검색', + resetButtonTitle: '검색 조건 초기화', + resetButtonAriaLabel: '검색 조건 초기화', + cancelButtonText: '취소', + cancelButtonAriaLabel: '취소', + linkToTheResultAriaLabel: '결과 링크', + selectText: '선택', + navigateText: '이동', + closeText: '닫기', + poweredByText: '제공자', + selectKeyAriaLabel: 'Enter 키', + closeKeyAriaLabel: 'ESC 키', + navigateUpKeyAriaLabel: '위쪽 화살표 키', + navigateDownKeyAriaLabel: '아래쪽 화살표 키', + }, + }, + ], + [ + ['fi', 'fi-FI'], + + { + button: { + buttonText: 'Hae', + buttonAriaLabel: 'Hae', + }, + modal: { + searchDocsPlaceHolder: 'Hae asiakirjoja', + resetButtonTitle: 'Nollaa hakuehdot', + resetButtonAriaLabel: 'Nollaa hakuehdot', + cancelButtonText: 'Peruuta', + cancelButtonAriaLabel: 'Peruuta', + linkToTheResultAriaLabel: 'Linkki tulokseen', + selectText: 'Valitse', + navigateText: 'Siirry', + closeText: 'Sulje', + poweredByText: 'Tarjoaja', + selectKeyAriaLabel: 'Enter-näppäin', + closeKeyAriaLabel: 'ESC-näppäin', + navigateUpKeyAriaLabel: 'Ylösnuoli-näppäin', + navigateDownKeyAriaLabel: 'Alasnuoli-näppäin', + }, + }, + ], + [ + ['hu', 'hu-HU'], + { + button: { + buttonText: 'Keresés', + buttonAriaLabel: 'Keresés', + }, + modal: { + searchDocsPlaceHolder: 'Dokumentum keresése', + resetButtonTitle: 'Keresési feltételek visszaállítása', + resetButtonAriaLabel: 'Keresési feltételek visszaállítása', + cancelButtonText: 'Mégse', + cancelButtonAriaLabel: 'Mégse', + linkToTheResultAriaLabel: 'Eredmény hivatkozás', + selectText: 'Kiválasztás', + navigateText: 'Ugrás', + closeText: 'Bezárás', + poweredByText: 'Szolgáltató', + selectKeyAriaLabel: 'Enter billentyű', + closeKeyAriaLabel: 'ESC billentyű', + navigateUpKeyAriaLabel: 'Felfelé nyíl billentyű', + navigateDownKeyAriaLabel: 'Lefelé nyíl billentyű', + }, + }, + ], + [ + ['id', 'id-ID'], + { + button: { + buttonText: 'Cari', + buttonAriaLabel: 'Cari', + }, + modal: { + searchDocsPlaceHolder: 'Cari dokumen', + resetButtonTitle: 'Atur ulang kriteria pencarian', + resetButtonAriaLabel: 'Atur ulang kriteria pencarian', + cancelButtonText: 'Batal', + cancelButtonAriaLabel: 'Batal', + linkToTheResultAriaLabel: 'Link ke hasil', + selectText: 'Pilih', + navigateText: 'Navigasi', + closeText: 'Tutup', + poweredByText: 'Penyedia', + selectKeyAriaLabel: 'Tombol Enter', + closeKeyAriaLabel: 'Tombol ESC', + navigateUpKeyAriaLabel: 'Tombol panah atas', + navigateDownKeyAriaLabel: 'Tombol panah bawah', + }, + }, + ], + [ + ['nl', 'nl-NL'], + { + button: { + buttonText: 'Zoeken', + buttonAriaLabel: 'Zoeken', + }, + modal: { + searchDocsPlaceHolder: 'Documenten doorzoeken', + resetButtonTitle: 'Zoekcriteria resetten', + resetButtonAriaLabel: 'Zoekcriteria resetten', + cancelButtonText: 'Annuleren', + cancelButtonAriaLabel: 'Annuleren', + linkToTheResultAriaLabel: 'Link naar resultaat', + selectText: 'Selecteren', + navigateText: 'Navigeren', + closeText: 'Sluiten', + poweredByText: 'Aanbieder', + selectKeyAriaLabel: 'Enter-toets', + closeKeyAriaLabel: 'ESC-toets', + navigateUpKeyAriaLabel: 'Pijltje omhoog-toets', + navigateDownKeyAriaLabel: 'Pijltje omlaag-toets', + }, + }, + ], +] diff --git a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts index 4a4ec42fce..387b2c9ca7 100644 --- a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts +++ b/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts @@ -1,18 +1,38 @@ +import { entries, fromEntries, getFullLocaleConfig } from '@vuepress/helper' import type { Plugin } from 'vuepress' import { getDirname, path } from 'vuepress/utils' +import type { MeiliSearchOptions } from '../shared/index.js' +import { localeInfo } from './locales.js' -import type { MeiliSearchPluginOptions } from './option.js' +export type MeiliSearchPluginOptions = MeiliSearchOptions const __dirname = getDirname(import.meta.url) -export const meiliSearchPlugin = ( - options: MeiliSearchPluginOptions, -): Plugin => ({ - name: '@vuepress/plugin-meilisearch', +const PLUGIN_NAME = '@vuepress/plugin-meilisearch' - define: { - __MM_SEARCH__: options, - }, +export const meiliSearchPlugin = + ({ + locales = {}, + translations: rootTranslations, + ...options + }: MeiliSearchPluginOptions): Plugin => + (app) => ({ + name: PLUGIN_NAME, - clientConfigFile: path.resolve(__dirname, '../client/config.js'), -}) + define: { + __ML_SEARCH_LOCALES__: getFullLocaleConfig({ + app, + name: PLUGIN_NAME, + default: localeInfo, + config: fromEntries( + entries({ + '/': { translations: rootTranslations }, + ...locales, + }).map(([key, { translations = {} }]) => [key, translations]), + ), + }), + __ML_SEARCH_OPTIONS__: options, + }, + + clientConfigFile: path.resolve(__dirname, '../client/config.js'), + }) diff --git a/plugins/search/plugin-meilisearch/src/node/option.ts b/plugins/search/plugin-meilisearch/src/node/option.ts deleted file mode 100644 index dd3d1d015b..0000000000 --- a/plugins/search/plugin-meilisearch/src/node/option.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { MeiliSearchDocSearchOptions } from '../shared/index.js' - -export type MeiliSearchPluginOptions = MeiliSearchDocSearchOptions diff --git a/plugins/search/plugin-meilisearch/src/shared/index.ts b/plugins/search/plugin-meilisearch/src/shared/index.ts index 8b0a480486..87b012b2a6 100644 --- a/plugins/search/plugin-meilisearch/src/shared/index.ts +++ b/plugins/search/plugin-meilisearch/src/shared/index.ts @@ -1,6 +1,16 @@ +import type { DeepRequired } from '@vuepress/helper/shared' import type { DocSearchOptions } from 'meilisearch-docsearch' +import type { LocaleConfig } from 'vuepress/shared' -export type MeiliSearchDocSearchOptions = Omit< +export type MeiliSearchLocaleData = DeepRequired< + Exclude +> + +export type MeiliSearchDocSearchLocaleOptions = Omit< DocSearchOptions, 'container' | 'environment' > + +export interface MeiliSearchOptions extends MeiliSearchDocSearchLocaleOptions { + locales?: LocaleConfig +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7343efc89d..fb96b78936 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1066,6 +1066,9 @@ importers: plugins/search/plugin-meilisearch: dependencies: + '@vuepress/helper': + specifier: workspace:* + version: link:../../../tools/helper meilisearch: specifier: 0.49.0 version: 0.49.0 @@ -1077,7 +1080,7 @@ importers: version: 3.5.13(typescript@5.8.2) vuepress: specifier: 'catalog:' - version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.1)(typescript@5.8.2))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)) + version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.15)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.2)(typescript@5.8.2))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)) plugins/search/plugin-search: dependencies: diff --git a/tools/helper/src/shared/index.ts b/tools/helper/src/shared/index.ts index 4323729154..5679643d44 100644 --- a/tools/helper/src/shared/index.ts +++ b/tools/helper/src/shared/index.ts @@ -5,3 +5,4 @@ export * from './helper.js' export * from './link.js' export type * from './locales.js' export type * from './key.js' +export type * from './types.js' diff --git a/tools/helper/src/shared/types.ts b/tools/helper/src/shared/types.ts new file mode 100644 index 0000000000..77ed2ca6cf --- /dev/null +++ b/tools/helper/src/shared/types.ts @@ -0,0 +1,14 @@ +// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type +type Primitive = Function | boolean | number | string | null | undefined + +type NotNill = T extends null | undefined ? never : T + +export type DeepRequired = T extends Primitive + ? NotNill + : { + [P in keyof T]-?: T[P] extends (infer U)[] + ? DeepRequired[] + : T[P] extends readonly (infer V)[] + ? DeepRequired + : DeepRequired + } From a65a2b0219d608e559304f5086c091334776d067 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 2 Apr 2025 19:51:40 +0800 Subject: [PATCH 15/46] chore: tweaks --- plugins/search/plugin-slimsearch/package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/search/plugin-slimsearch/package.json b/plugins/search/plugin-slimsearch/package.json index 9358cb1d15..139f1730ed 100644 --- a/plugins/search/plugin-slimsearch/package.json +++ b/plugins/search/plugin-slimsearch/package.json @@ -18,11 +18,7 @@ "directory": "plugins/search/plugin-slimsearch" }, "license": "MIT", - "author": { - "name": "Mr.Hope", - "email": "mister-hope@outlook.com", - "url": "https://mister-hope.com" - }, + "author": "Mr.Hope,JQiue", "type": "module", "exports": { ".": "./lib/node/index.js", From edfd72ca12c17067a1f7046463b759ddcba72989 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 2 Apr 2025 20:02:08 +0800 Subject: [PATCH 16/46] feat: add missing locales --- .../plugin-docsearch/src/node/locales.ts | 91 ++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/plugins/search/plugin-docsearch/src/node/locales.ts b/plugins/search/plugin-docsearch/src/node/locales.ts index 1b86aac434..e4e1c25e2b 100644 --- a/plugins/search/plugin-docsearch/src/node/locales.ts +++ b/plugins/search/plugin-docsearch/src/node/locales.ts @@ -15,6 +15,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: '搜索', resetButtonTitle: '清除查询条件', resetButtonAriaLabel: '清除查询条件', cancelButtonText: '取消', @@ -34,8 +35,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: '选择', + selectKeyAriaLabel: '选择一个结果', navigateText: '切换', + navigateUpKeyAriaLabel: '上箭头', + navigateDownKeyAriaLabel: '下箭头', closeText: '关闭', + closeKeyAriaLabel: 'ESC 键', searchByText: '搜索提供者', }, noResultsScreen: { @@ -59,6 +64,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: '搜尋', resetButtonTitle: '清除查詢條件', resetButtonAriaLabel: '清除查詢條件', cancelButtonText: '取消', @@ -78,8 +84,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: '選擇', + selectKeyAriaLabel: '選擇一個結果', navigateText: '切換', + navigateUpKeyAriaLabel: '上箭頭', + navigateDownKeyAriaLabel: '下箭頭', closeText: '關閉', + closeKeyAriaLabel: 'ESC 鍵', searchByText: '搜尋提供者', }, noResultsScreen: { @@ -103,11 +113,11 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Suche', resetButtonTitle: 'Suchkriterien zurücksetzen', resetButtonAriaLabel: 'Suchkriterien zurücksetzen', cancelButtonText: 'Abbrechen', cancelButtonAriaLabel: 'Abbrechen', - searchInputLabel: 'Suche', }, startScreen: { recentSearchesTitle: 'Letzte Suchen', @@ -123,8 +133,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Auswählen', + selectKeyAriaLabel: 'Ein Ergebnis auswählen', navigateText: 'Navigieren', + navigateUpKeyAriaLabel: 'Nach oben Pfeil', + navigateDownKeyAriaLabel: 'Nach unten Pfeil', closeText: 'Schließen', + closeKeyAriaLabel: 'ESC-Taste', searchByText: 'Suchanbieter', }, noResultsScreen: { @@ -149,6 +163,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Tìm kiếm', resetButtonTitle: 'Xóa điều kiện tìm kiếm', resetButtonAriaLabel: 'Xóa điều kiện tìm kiếm', cancelButtonText: 'Hủy', @@ -168,8 +183,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Chọn', + selectKeyAriaLabel: 'Chọn một kết quả', navigateText: 'Chuyển đến', + navigateUpKeyAriaLabel: 'Mũi tên lên', + navigateDownKeyAriaLabel: 'Mũi tên xuống', closeText: 'Đóng', + closeKeyAriaLabel: 'Phím ESC', searchByText: 'Nhà cung cấp tìm kiếm', }, noResultsScreen: { @@ -193,6 +212,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Пошук', resetButtonTitle: 'Скинути умови пошуку', resetButtonAriaLabel: 'Скинути умови пошуку', cancelButtonText: 'Скасувати', @@ -212,8 +232,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Вибрати', + selectKeyAriaLabel: 'Вибрати результат', navigateText: 'Перейти', + navigateUpKeyAriaLabel: 'Стрілка вгору', + navigateDownKeyAriaLabel: 'Стрілка вниз', closeText: 'Закрити', + closeKeyAriaLabel: 'ESC', searchByText: 'Постачальник пошуку', }, noResultsScreen: { @@ -237,6 +261,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Поиск', resetButtonTitle: 'Сбросить условия поиска', resetButtonAriaLabel: 'Сбросить условия поиска', cancelButtonText: 'Отмена', @@ -256,8 +281,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Выбрать', + selectKeyAriaLabel: 'Выбрать результат', navigateText: 'Перейти', + navigateUpKeyAriaLabel: 'Стрелка вверх', + navigateDownKeyAriaLabel: 'Стрелка вниз', closeText: 'Закрыть', + closeKeyAriaLabel: 'ESC', searchByText: 'Поставщик поиска', }, noResultsScreen: { @@ -281,6 +310,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Pesquisar', resetButtonTitle: 'Limpar critérios de pesquisa', resetButtonAriaLabel: 'Limpar critérios de pesquisa', cancelButtonText: 'Cancelar', @@ -300,8 +330,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Selecionar', + selectKeyAriaLabel: 'Selecionar um resultado', navigateText: 'Navegar', + navigateUpKeyAriaLabel: 'Seta para cima', + navigateDownKeyAriaLabel: 'Seta para baixo', closeText: 'Fechar', + closeKeyAriaLabel: 'Tecla ESC', searchByText: 'Provedor de pesquisa', }, noResultsScreen: { @@ -325,6 +359,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Szukaj', resetButtonTitle: 'Wyczyść kryteria wyszukiwania', resetButtonAriaLabel: 'Wyczyść kryteria wyszukiwania', cancelButtonText: 'Anuluj', @@ -344,8 +379,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Wybierz', + selectKeyAriaLabel: 'Wybierz wynik', navigateText: 'Przejdź', + navigateUpKeyAriaLabel: 'Strzałka w górę', + navigateDownKeyAriaLabel: 'Strzałka w dół', closeText: 'Zamknij', + closeKeyAriaLabel: 'Klucz ESC', searchByText: 'Dostawca wyszukiwania', }, noResultsScreen: { @@ -369,6 +408,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Hľadať', resetButtonTitle: 'Vymazať kritériá vyhľadávania', resetButtonAriaLabel: 'Vymazať kritériá vyhľadávania', cancelButtonText: 'Zrušiť', @@ -388,8 +428,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Vybrať', + selectKeyAriaLabel: 'Vybrať výsledok', navigateText: 'Prejsť', + navigateUpKeyAriaLabel: 'Šípka nahor', + navigateDownKeyAriaLabel: 'Šípka nadol', closeText: 'Zavrieť', + closeKeyAriaLabel: 'Kláves ESC', searchByText: 'Poskytovateľ vyhľadávania', }, noResultsScreen: { @@ -413,6 +457,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Rechercher', resetButtonTitle: 'Réinitialiser les critères de recherche', resetButtonAriaLabel: 'Réinitialiser les critères de recherche', cancelButtonText: 'Annuler', @@ -433,8 +478,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Sélectionner', + selectKeyAriaLabel: 'Sélectionner un résultat', navigateText: 'Naviguer', + navigateUpKeyAriaLabel: 'Flèche vers le haut', + navigateDownKeyAriaLabel: 'Flèche vers le bas', closeText: 'Fermer', + closeKeyAriaLabel: 'Touche ÉCHAP', searchByText: 'Fournisseur de recherche', }, noResultsScreen: { @@ -459,6 +508,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Buscar', resetButtonTitle: 'Restablecer criterios de búsqueda', resetButtonAriaLabel: 'Restablecer criterios de búsqueda', cancelButtonText: 'Cancelar', @@ -478,8 +528,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Seleccionar', + selectKeyAriaLabel: 'Seleccionar un resultado', navigateText: 'Navegar', + navigateUpKeyAriaLabel: 'Flecha hacia arriba', + navigateDownKeyAriaLabel: 'Flecha hacia abajo', closeText: 'Cerrar', + closeKeyAriaLabel: 'Tecla ESC', searchByText: 'Proveedor de búsqueda', }, noResultsScreen: { @@ -503,6 +557,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: '検索', resetButtonTitle: '検索条件をリセット', resetButtonAriaLabel: '検索条件をリセット', cancelButtonText: 'キャンセル', @@ -522,8 +577,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: '選択', + selectKeyAriaLabel: '結果を選択', navigateText: '移動', + navigateUpKeyAriaLabel: '上矢印', + navigateDownKeyAriaLabel: '下矢印', closeText: '閉じる', + closeKeyAriaLabel: 'ESCキー', searchByText: '検索プロバイダ', }, noResultsScreen: { @@ -547,6 +606,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Ara', resetButtonTitle: 'Arama kriterlerini sıfırla', resetButtonAriaLabel: 'Arama kriterlerini sıfırla', cancelButtonText: 'İptal', @@ -566,8 +626,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Seç', + selectKeyAriaLabel: 'Bir sonucu seç', navigateText: 'Gezin', + navigateUpKeyAriaLabel: 'Yukarı ok', + navigateDownKeyAriaLabel: 'Aşağı ok', closeText: 'Kapat', + closeKeyAriaLabel: 'ESC tuşu', searchByText: 'Arama sağlayıcısı', }, noResultsScreen: { @@ -592,6 +656,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: '검색', resetButtonTitle: '검색 조건 초기화', resetButtonAriaLabel: '검색 조건 초기화', cancelButtonText: '취소', @@ -611,8 +676,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: '선택', + selectKeyAriaLabel: '결과 선택', navigateText: '이동', + navigateUpKeyAriaLabel: '위쪽 화살표', + navigateDownKeyAriaLabel: '아래쪽 화살표', closeText: '닫기', + closeKeyAriaLabel: 'ESC 키', searchByText: '검색 제공업체', }, noResultsScreen: { @@ -636,6 +705,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Hae', resetButtonTitle: 'Nollaa hakuehdot', resetButtonAriaLabel: 'Nollaa hakuehdot', cancelButtonText: 'Peruuta', @@ -655,8 +725,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Valitse', + selectKeyAriaLabel: 'Valitse tulos', navigateText: 'Siirry', + navigateUpKeyAriaLabel: 'Ylös nuoli', + navigateDownKeyAriaLabel: 'Alas nuoli', closeText: 'Sulje', + closeKeyAriaLabel: 'ESC-näppäin', searchByText: 'Hakupalveluntarjoaja', }, noResultsScreen: { @@ -680,6 +754,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Keresés', resetButtonTitle: 'Keresési feltételek visszaállítása', resetButtonAriaLabel: 'Keresési feltételek visszaállítása', cancelButtonText: 'Mégse', @@ -700,8 +775,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Kiválasztás', + selectKeyAriaLabel: 'Találat kiválasztása', navigateText: 'Ugrás', + navigateUpKeyAriaLabel: 'Felfelé mutató nyíl', + navigateDownKeyAriaLabel: 'Lefelé mutató nyíl', closeText: 'Bezárás', + closeKeyAriaLabel: 'ESC gomb', searchByText: 'Keresési szolgáltató', }, noResultsScreen: { @@ -726,6 +805,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Cari', resetButtonTitle: 'Atur ulang kriteria pencarian', resetButtonAriaLabel: 'Atur ulang kriteria pencarian', cancelButtonText: 'Batal', @@ -745,8 +825,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Pilih', + selectKeyAriaLabel: 'Pilih hasil', navigateText: 'Navigasi', + navigateUpKeyAriaLabel: 'Panah atas', + navigateDownKeyAriaLabel: 'Panah bawah', closeText: 'Tutup', + closeKeyAriaLabel: 'Tombol ESC', searchByText: 'Penyedia pencarian', }, noResultsScreen: { @@ -770,6 +854,7 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, modal: { searchBox: { + searchInputLabel: 'Zoeken', resetButtonTitle: 'Zoekcriteria resetten', resetButtonAriaLabel: 'Zoekcriteria resetten', cancelButtonText: 'Annuleren', @@ -790,8 +875,12 @@ export const docSearchLocaleInfo: DefaultLocaleInfo = [ }, footer: { selectText: 'Selecteren', + selectKeyAriaLabel: 'Selecteer een resultaat', navigateText: 'Navigeren', + navigateUpKeyAriaLabel: 'Omhoog pijltje', + navigateDownKeyAriaLabel: 'Omlaag pijltje', closeText: 'Sluiten', + closeKeyAriaLabel: 'ESC-toets', searchByText: 'Zoekprovider', }, noResultsScreen: { From ef86220af5f75e0a1f5d0bcbc7cc58d744102137 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 2 Apr 2025 20:07:34 +0800 Subject: [PATCH 17/46] chore: revert --- plugins/search/plugin-slimsearch/package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/search/plugin-slimsearch/package.json b/plugins/search/plugin-slimsearch/package.json index 139f1730ed..9358cb1d15 100644 --- a/plugins/search/plugin-slimsearch/package.json +++ b/plugins/search/plugin-slimsearch/package.json @@ -18,7 +18,11 @@ "directory": "plugins/search/plugin-slimsearch" }, "license": "MIT", - "author": "Mr.Hope,JQiue", + "author": { + "name": "Mr.Hope", + "email": "mister-hope@outlook.com", + "url": "https://mister-hope.com" + }, "type": "module", "exports": { ".": "./lib/node/index.js", From 3099787b5bcafd1c7e70756fccb8c9aafcb2c661 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 2 Apr 2025 20:09:45 +0800 Subject: [PATCH 18/46] docs: update docs --- docs/plugins/search/meilisearch.md | 8 ++++---- docs/zh/plugins/search/meilisearch.md | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 7d099e0e40..cc2980b25c 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -97,7 +97,7 @@ meilisearchPlugin({ - Details: - Provide the HTTP address of the MeiliSearch API + Provide the HTTP address of the MeiliSearch API. ### apiKey @@ -107,7 +107,7 @@ meilisearchPlugin({ - Details: - API key generated by MeiliSearch + API key generated by MeiliSearch. ### indexUid @@ -117,7 +117,7 @@ meilisearchPlugin({ - Details: - Specify the index name used for searching + Specify the index name used for searching. ### translations @@ -125,7 +125,7 @@ meilisearchPlugin({ - Details: - Allows you to replace the default text in the DocSearch button and popup + Allows you to replace the default text in the DocSearch button and popup. ### hotKeys diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index e57d53529a..1b0cdcc51f 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -31,7 +31,7 @@ export default { ## Self-hosting MeiliSearch -MeiliSearch 提供了一个服务器程序,支持使用云服务器的用户的自部署选项。为了简化在服务器端运行 MeiliSearch 的过程,您可以使用 Docker 进行安装和管理。 +MeiliSearch 提供了一个服务器程序,支持使用云服务器的用户的自部署选项。为了简化在服务器端运行 MeiliSearch 的过程,你可以使用 Docker 进行安装和管理。 ```sh docker pull getmeili/meilisearch:latest @@ -77,7 +77,7 @@ curl \ } ``` -该密钥可以根据需要在外部公开和使用,填入到你的插件选项中 +该密钥可以根据需要在外部公开和使用,填入到你的插件选项中: ```ts meilisearchPlugin({ @@ -97,7 +97,7 @@ meilisearchPlugin({ - 详情: - 提供 MeiliSearch API 的 HTTP 地址 + 提供 MeiliSearch API 的 HTTP 地址。 ### apiKey @@ -107,7 +107,7 @@ meilisearchPlugin({ - 详情: - MeiliSearch 生成的 API 密钥 + MeiliSearch 生成的 API 密钥。 ### indexUid @@ -117,7 +117,7 @@ meilisearchPlugin({ - 详情: - 指定用于搜索的索引名称 + 指定用于搜索的索引名称。 ### translations @@ -125,7 +125,7 @@ meilisearchPlugin({ - 详情: - 允许您替换 DocSearch 按钮和弹出框中的默认文本 + 允许你替换 DocSearch 按钮和弹出框中的默认文本。 ### hotKeys @@ -135,7 +135,7 @@ meilisearchPlugin({ - 详情: - 触发搜索框的热键数组, 当设置 `false` 时无法用任何快捷键触发搜索框 + 触发搜索框的热键数组, 当设置 `false` 时无法用任何快捷键触发搜索框。 ### debounceDuration @@ -145,7 +145,7 @@ meilisearchPlugin({ - 详情: - 在按键之间等待的毫秒数,以确定是否应该进行搜索。设置 `0` 或者 `false` 逻辑上是等效的 + 在按键之间等待的毫秒数,以确定是否应该进行搜索。设置 `0` 或者 `false` 逻辑上是等效的。 ### searchParams @@ -153,7 +153,7 @@ meilisearchPlugin({ - 详情: - - [more](https://www.meilisearch.com/docs/reference/api/search#search-parameters) + - [更多](https://www.meilisearch.com/docs/reference/api/search#search-parameters) ## 组件 From 5f05095f030308cf8fc9c9764d4a210c3e125cd0 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Mon, 7 Apr 2025 11:49:50 +0800 Subject: [PATCH 19/46] fix: fix types --- plugins/search/plugin-meilisearch/src/client/config.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/search/plugin-meilisearch/src/client/config.ts b/plugins/search/plugin-meilisearch/src/client/config.ts index 1828540d04..3382e9dbf1 100644 --- a/plugins/search/plugin-meilisearch/src/client/config.ts +++ b/plugins/search/plugin-meilisearch/src/client/config.ts @@ -1,14 +1,15 @@ +import type { ExactLocaleConfig } from '@vuepress/helper/client' import { h } from 'vue' import { defineClientConfig } from 'vuepress/client' import type { - MeiliSearchDocSearchLocaleOptions, + MeiliSearchLocaleData, MeiliSearchOptions, } from '../shared/index.js' import { MeiliSearch } from './components/index.js' declare const __ML_SEARCH_OPTIONS__: MeiliSearchOptions -declare const __ML_SEARCH_LOCALES__: MeiliSearchDocSearchLocaleOptions +declare const __ML_SEARCH_LOCALES__: ExactLocaleConfig export default defineClientConfig({ enhance({ app }) { From 649bb407900fd1ef8e4a602e6a60049165f8da8a Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Mon, 7 Apr 2025 12:07:29 +0800 Subject: [PATCH 20/46] docs: correct docs --- docs/plugins/search/meilisearch.md | 6 +++--- docs/zh/plugins/search/meilisearch.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index cc2980b25c..dc47c7f50d 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -15,11 +15,11 @@ npm i -D @vuepress/plugin-meilisearch@next ``` ```ts -import { MeiliSearchPlugin } from 'vuepress-plugin-meilisearch2' +import { MeiliSearchPlugin } from '@vuepress/plugin-meilisearch' export default { plugins: [ - meilisearchPlugin({ + meiliSearchPlugin({ // Configuration options host: '', apiKey: '', @@ -80,7 +80,7 @@ If successful, the response would look like this: This key can be exposed and used externally as needed. Enter it in your plugin options. ```ts -meilisearchPlugin({ +meiliSearchPlugin({ host: 'YOUR_HOST', apiKey: 'adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213', indexUid: 'YOUR_INDEX_NAME', diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 1b0cdcc51f..68e0530af5 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -15,11 +15,11 @@ npm i -D @vuepress/plugin-meilisearch@next ``` ```ts -import { meilisearchPlugin } from '@vuepress/plugin-meilisearch' +import { meiliSearchPlugin } from '@vuepress/plugin-meilisearch' export default { plugins: [ - meilisearchPlugin({ + meiliSearchPlugin({ // 配置项 host: '', apiKey: '', @@ -80,7 +80,7 @@ curl \ 该密钥可以根据需要在外部公开和使用,填入到你的插件选项中: ```ts -meilisearchPlugin({ +meiliSearchPlugin({ host: 'YOUR_HOST', apiKey: 'adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213', indexUid: 'YOUR_INDEX_NAME', From 27a4ef0dd8c803860f838fd9a5e6f858de75aa24 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 7 Apr 2025 12:48:49 +0800 Subject: [PATCH 21/46] docs: update docs --- docs/plugins/search/meilisearch.md | 47 ++++++++++++++++++++++-- docs/zh/plugins/search/meilisearch.md | 51 ++++++++++++++++++++++++--- 2 files changed, 92 insertions(+), 6 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index dc47c7f50d..ddd81b106d 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -43,16 +43,59 @@ On the first startup, a Master Key will be generated by default. **Do not expose docker run -it --rm \ -p 7700:7700 \ -v $(pwd)/meili_data:/meili_data \ - getmeili/meilisearch:v1.11 + getmeili/meilisearch:latest ``` +## Crawling the website + +MeiliSearch provides a Docker crawler to crawl documents. Until then, make sure MeiliSearch is running. + +Here is a sample configuration for grabbing the official VuePress documentation, saved locally: + +```json +{ + "index_uid": "YOUR_INDEX_NAME", + "start_urls": ["https://YOUR_WEBSITE_URL/"], + "sitemap_urls": ["https://YOUR_WEBSITE_URL/sitemap.xml"], + "selectors": { + "lvl0": { + "selector": ".vp-sidebar-heading.active", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "[vp-content] h1", + "lvl2": "[vp-content] h2", + "lvl3": "[vp-content] h3", + "lvl4": "[vp-content] h4", + "lvl5": "[vp-content] h5", + "lvl6": "[vp-content] h6", + "content": "[vp-content] p, [vp-content] li" + } +} +``` + +to start grabbing the document, `` is replaced with your master key, and `` is the absolute path to grab the configuration file: + +```sh +docker run -t --rm \ + --network=host \ + -e MEILISEARCH_HOST_URL='http://localhost:7700' \ + -e MEILISEARCH_API_KEY='' \ + -v :/docs-scraper/config.json \ + getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json +``` + +When the crawl is complete, MeiliSearch stores the crawled document in the specified index. + +## Get search index and api key + To create an access key that only allows search operations, use the following request. The `indexes` array specifies which indexes this key can access, and `expiresAt` sets the key's expiration date. ```sh curl \ -X POST 'http://localhost:7700/keys' \ -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer MASTER_KEY' \ + -H 'Authorization: Bearer ' \ --data-binary '{ "description": "Search records key", "actions": ["search"], diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 68e0530af5..87408731b4 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -29,7 +29,7 @@ export default { } ``` -## Self-hosting MeiliSearch +## 在服务器上运行 MeiliSearch MeiliSearch 提供了一个服务器程序,支持使用云服务器的用户的自部署选项。为了简化在服务器端运行 MeiliSearch 的过程,你可以使用 Docker 进行安装和管理。 @@ -37,22 +37,65 @@ MeiliSearch 提供了一个服务器程序,支持使用云服务器的用户 docker pull getmeili/meilisearch:latest ``` -在第一次启动时,默认情况下将生成一个主密钥。**不要暴露此密钥**;它应该只用于内部服务器访问,因为它拥有完全的操作权限。 +在第一次启动时,默认情况下将生成一个主密钥(MASTER_KEY)。**不要暴露此密钥**;它应该只用于内部服务器访问,因为它拥有完全的操作权限。 ```sh docker run -it --rm \ -p 7700:7700 \ -v $(pwd)/meili_data:/meili_data \ - getmeili/meilisearch:v1.11 + getmeili/meilisearch:latest ``` +## 抓取网站 + +MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 MeiliSearch 已经运行。 + +这是抓取 VuePress 官方文档的示例配置,保存在本地: + +```json +{ + "index_uid": "YOUR_INDEX_NAME", + "start_urls": ["https://YOUR_WEBSITE_URL/"], + "sitemap_urls": ["https://YOUR_WEBSITE_URL/sitemap.xml"], + "selectors": { + "lvl0": { + "selector": ".vp-sidebar-heading.active", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "[vp-content] h1", + "lvl2": "[vp-content] h2", + "lvl3": "[vp-content] h3", + "lvl4": "[vp-content] h4", + "lvl5": "[vp-content] h5", + "lvl6": "[vp-content] h6", + "content": "[vp-content] p, [vp-content] li" + } +} +``` + +开始抓取文档,``替换为你的主密钥,``是抓取配置文件的绝对路径: + +```sh +docker run -t --rm \ + --network=host \ + -e MEILISEARCH_HOST_URL='http://localhost:7700' \ + -e MEILISEARCH_API_KEY='' \ + -v :/docs-scraper/config.json \ + getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json +``` + +抓取完成后,MeiliSearch 将在指定的索引中存储抓取到的文档。 + +## 获取搜索索引和 apikey + 要创建只允许搜索操作的访问密钥,请使用以下请求。`indexes`数组指定该密钥可以访问哪些索引,`expiresAt`设置密钥的过期时间。 ```sh curl \ -X POST 'http://localhost:7700/keys' \ -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer MASTER_KEY' \ + -H 'Authorization: Bearer ' \ --data-binary '{ "description": "Search records key", "actions": ["search"], From 46c2ef9345d580134db5220ad1e9b7976094da91 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 7 Apr 2025 13:02:15 +0800 Subject: [PATCH 22/46] docs: update docs --- docs/plugins/search/meilisearch.md | 8 ++++++-- docs/zh/plugins/search/meilisearch.md | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index ddd81b106d..d225a93280 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -46,6 +46,8 @@ docker run -it --rm \ getmeili/meilisearch:latest ``` +> See + ## Crawling the website MeiliSearch provides a Docker crawler to crawl documents. Until then, make sure MeiliSearch is running. @@ -74,12 +76,12 @@ Here is a sample configuration for grabbing the official VuePress documentation, } ``` -to start grabbing the document, `` is replaced with your master key, and `` is the absolute path to grab the configuration file: +Start scraping the document, `MEILISEARCH_HOST_URL` is the address of the host running MeiliSearch, `` is the master key, `` is the absolute path to fetch the configuration file: ```sh docker run -t --rm \ --network=host \ - -e MEILISEARCH_HOST_URL='http://localhost:7700' \ + -e MEILISEARCH_HOST_URL='' \ -e MEILISEARCH_API_KEY='' \ -v :/docs-scraper/config.json \ getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json @@ -87,6 +89,8 @@ docker run -t --rm \ When the crawl is complete, MeiliSearch stores the crawled document in the specified index. +> See + ## Get search index and api key To create an access key that only allows search operations, use the following request. The `indexes` array specifies which indexes this key can access, and `expiresAt` sets the key's expiration date. diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 87408731b4..6de24cab11 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -46,6 +46,8 @@ docker run -it --rm \ getmeili/meilisearch:latest ``` +> 参考 + ## 抓取网站 MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 MeiliSearch 已经运行。 @@ -74,12 +76,12 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 } ``` -开始抓取文档,``替换为你的主密钥,``是抓取配置文件的绝对路径: +开始抓取文档,`MEILISEARCH_HOST_URL`是运行 MeiliSearch 的主机地址,``是主密钥,``是抓取配置文件的绝对路径: ```sh docker run -t --rm \ --network=host \ - -e MEILISEARCH_HOST_URL='http://localhost:7700' \ + -e MEILISEARCH_HOST_URL='' \ -e MEILISEARCH_API_KEY='' \ -v :/docs-scraper/config.json \ getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json @@ -87,6 +89,8 @@ docker run -t --rm \ 抓取完成后,MeiliSearch 将在指定的索引中存储抓取到的文档。 +> 看 + ## 获取搜索索引和 apikey 要创建只允许搜索操作的访问密钥,请使用以下请求。`indexes`数组指定该密钥可以访问哪些索引,`expiresAt`设置密钥的过期时间。 From dcd57322d55e8e5927a39ccc21c8f6ffffc13750 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 7 Apr 2025 13:51:42 +0800 Subject: [PATCH 23/46] docs: update docs --- docs/zh/plugins/search/meilisearch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 6de24cab11..73f04f9fbc 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -76,7 +76,7 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 } ``` -开始抓取文档,`MEILISEARCH_HOST_URL`是运行 MeiliSearch 的主机地址,``是主密钥,``是抓取配置文件的绝对路径: +开始抓取文档,`MEILISEARCH_HOST_URL`是运行 MeiliSearch 的主机地址,``是主密钥,``是抓取配置文件的绝对路径: ```sh docker run -t --rm \ @@ -89,7 +89,7 @@ docker run -t --rm \ 抓取完成后,MeiliSearch 将在指定的索引中存储抓取到的文档。 -> 看 +> 参考 ## 获取搜索索引和 apikey From c90e1616fec4084437707d0e1ac08e986d5e4782 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 9 Apr 2025 13:08:23 +0800 Subject: [PATCH 24/46] chore: fix broken lockfile --- pnpm-lock.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 186d8be3a1..b447970889 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1077,10 +1077,10 @@ importers: version: 0.7.1 vue: specifier: ^3.5.13 - version: 3.5.13(typescript@5.8.2) + version: 3.5.13(typescript@5.8.3) vuepress: specifier: 'catalog:' - version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.15)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.2)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.2)(typescript@5.8.2))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)) + version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.3)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.2)(typescript@5.8.3))(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) plugins/search/plugin-search: dependencies: From c94c893f7dfb17a603ff3f1fda599d000149afd8 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 19:51:15 +0800 Subject: [PATCH 25/46] style: fix linter --- .../src/client/composables/useActiveHeaderLinks.ts | 2 +- plugins/search/plugin-meilisearch/src/shim.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/development/plugin-active-header-links/src/client/composables/useActiveHeaderLinks.ts b/plugins/development/plugin-active-header-links/src/client/composables/useActiveHeaderLinks.ts index 057084545f..4ac48e9632 100644 --- a/plugins/development/plugin-active-header-links/src/client/composables/useActiveHeaderLinks.ts +++ b/plugins/development/plugin-active-header-links/src/client/composables/useActiveHeaderLinks.ts @@ -41,7 +41,7 @@ export const useActiveHeaderLinks = ({ document.body.scrollTop, ) // check if we are at page top - const isAtPageTop = Math.abs(scrollTop - 0) < offset + const isAtPageTop = Math.abs(scrollTop) < offset // replace current route hash with empty string when scrolling back to the top if (isAtPageTop) { diff --git a/plugins/search/plugin-meilisearch/src/shim.d.ts b/plugins/search/plugin-meilisearch/src/shim.d.ts index bf554924f3..f07bbd3361 100644 --- a/plugins/search/plugin-meilisearch/src/shim.d.ts +++ b/plugins/search/plugin-meilisearch/src/shim.d.ts @@ -1,5 +1,6 @@ declare module '*.vue' { import type { ComponentOptions } from 'vue' + const comp: ComponentOptions export default comp } From 599bb80db0595032ac26be85fd296e7733253317 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 19:52:21 +0800 Subject: [PATCH 26/46] chore: tweaks --- docs/plugins/search/meilisearch.md | 4 ++-- docs/zh/plugins/search/meilisearch.md | 6 +++--- .../plugin-meilisearch/src/client/components/MeiliSearch.ts | 4 ++-- plugins/search/plugin-meilisearch/src/node/index.ts | 2 +- .../src/node/{meiliSearchPlugin.ts => meilisearchPlugin.ts} | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) rename plugins/search/plugin-meilisearch/src/node/{meiliSearchPlugin.ts => meilisearchPlugin.ts} (96%) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index d225a93280..29aefddeec 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -19,7 +19,7 @@ import { MeiliSearchPlugin } from '@vuepress/plugin-meilisearch' export default { plugins: [ - meiliSearchPlugin({ + meilisearchPlugin({ // Configuration options host: '', apiKey: '', @@ -127,7 +127,7 @@ If successful, the response would look like this: This key can be exposed and used externally as needed. Enter it in your plugin options. ```ts -meiliSearchPlugin({ +meilisearchPlugin({ host: 'YOUR_HOST', apiKey: 'adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213', indexUid: 'YOUR_INDEX_NAME', diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 73f04f9fbc..240c9dab86 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -15,11 +15,11 @@ npm i -D @vuepress/plugin-meilisearch@next ``` ```ts -import { meiliSearchPlugin } from '@vuepress/plugin-meilisearch' +import { meilisearchPlugin } from '@vuepress/plugin-meilisearch' export default { plugins: [ - meiliSearchPlugin({ + meilisearchPlugin({ // 配置项 host: '', apiKey: '', @@ -127,7 +127,7 @@ curl \ 该密钥可以根据需要在外部公开和使用,填入到你的插件选项中: ```ts -meiliSearchPlugin({ +meilisearchPlugin({ host: 'YOUR_HOST', apiKey: 'adaf72e2a6d6f428ec465bc786ec41de868bbd53121997e89ba2299e9566c88213', indexUid: 'YOUR_INDEX_NAME', diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index ec7554c168..04a49c147b 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -31,7 +31,7 @@ export const MeiliSearch = defineComponent({ const locale = useLocaleConfig(props.locales) const routeLocale = useRouteLocale() - const meiliSearchOptions = computed(() => { + const meilisearchOptions = computed(() => { const { locales = {}, ...rest } = props.options return { @@ -47,7 +47,7 @@ export const MeiliSearch = defineComponent({ const { docsearch } = await import('meilisearch-docsearch') docsearch({ - ...meiliSearchOptions.value, + ...meilisearchOptions.value, container: '#docsearch', }) diff --git a/plugins/search/plugin-meilisearch/src/node/index.ts b/plugins/search/plugin-meilisearch/src/node/index.ts index 0a9969f588..32b45546a6 100644 --- a/plugins/search/plugin-meilisearch/src/node/index.ts +++ b/plugins/search/plugin-meilisearch/src/node/index.ts @@ -1,2 +1,2 @@ export * from './locales.js' -export * from './meiliSearchPlugin.js' +export * from './meilisearchPlugin.js' diff --git a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts similarity index 96% rename from plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts rename to plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts index 387b2c9ca7..252ad80a0a 100644 --- a/plugins/search/plugin-meilisearch/src/node/meiliSearchPlugin.ts +++ b/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts @@ -10,7 +10,7 @@ const __dirname = getDirname(import.meta.url) const PLUGIN_NAME = '@vuepress/plugin-meilisearch' -export const meiliSearchPlugin = +export const meilisearchPlugin = ({ locales = {}, translations: rootTranslations, From b4a5ca0540dcb9c4f796858d685b35ce260e2703 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 22:10:00 +0800 Subject: [PATCH 27/46] fix: fix bundle issue --- plugins/search/plugin-meilisearch/rollup.config.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/search/plugin-meilisearch/rollup.config.ts b/plugins/search/plugin-meilisearch/rollup.config.ts index e377928bcd..6d1d9fe49e 100644 --- a/plugins/search/plugin-meilisearch/rollup.config.ts +++ b/plugins/search/plugin-meilisearch/rollup.config.ts @@ -7,6 +7,8 @@ export default [ { external: ['meilisearch-docsearch', 'meilisearch-docsearch/css'], dtsExternal: ['meilisearch-docsearch/css'], + moduleSideEffects: (id) => + id.endsWith('.css') || id === 'meilisearch-docsearch/css', }, ), ] From c52045b460ad27368d0d00e1f3b745ea65624551 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 22:10:06 +0800 Subject: [PATCH 28/46] chore: tweaks --- .../plugin-meilisearch/src/client/components/MeiliSearch.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index 04a49c147b..1aacea1f03 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -9,9 +9,10 @@ import type { MeiliSearchOptions, } from '../../shared/index.js' -import 'meilisearch-docsearch/css' import { getSearchButtonTemplate } from '../utils/getSearchButtonTemplate.js' +import 'meilisearch-docsearch/css' + export const MeiliSearch = defineComponent({ name: 'MeiliSearch', From 43a36d6b6e27b3fc5fc0baf3bce47110bc94cb2e Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 22:20:48 +0800 Subject: [PATCH 29/46] fix: watch routeLocale --- .../src/client/components/MeiliSearch.ts | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index 1aacea1f03..5c5743aa04 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -1,6 +1,14 @@ import { useLocaleConfig } from '@vuepress/helper/client' import type { PropType } from 'vue' -import { computed, defineComponent, h, onMounted, ref } from 'vue' +import { + computed, + defineComponent, + h, + onMounted, + onUnmounted, + ref, + watch, +} from 'vue' import { useRouteLocale } from 'vuepress/client' import type { LocaleConfig } from 'vuepress/shared' @@ -43,11 +51,13 @@ export const MeiliSearch = defineComponent({ }) const hasInitialized = ref(false) + let currentInitialization: Promise + let destroy: () => void const initialize = async (): Promise => { const { docsearch } = await import('meilisearch-docsearch') - docsearch({ + destroy = docsearch({ ...meilisearchOptions.value, container: '#docsearch', }) @@ -56,7 +66,21 @@ export const MeiliSearch = defineComponent({ } onMounted(() => { - void initialize() + currentInitialization = initialize() + + // reinitialize when locale changes + watch(routeLocale, async () => { + await currentInitialization + + destroy() + hasInitialized.value = false + currentInitialization = initialize() + }) + }) + + onUnmounted(() => { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + destroy?.() }) return () => [ From 5f1c3d88dc313273a758a416a07e353dd8da7982 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 22:33:46 +0800 Subject: [PATCH 30/46] ci: fix lockfile --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index df26488b08..20c7a82a9d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1080,7 +1080,7 @@ importers: version: 3.5.13(typescript@5.8.3) vuepress: specifier: 'catalog:' - version: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.0)(sass@1.86.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.3)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.20(esbuild@0.25.2)(typescript@5.8.3))(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) + version: 2.0.0-rc.21(@vuepress/bundler-vite@2.0.0-rc.21(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(sass-embedded@1.86.3)(sass@1.86.3)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.3)(yaml@2.7.0))(@vuepress/bundler-webpack@2.0.0-rc.21(esbuild@0.25.2)(typescript@5.8.3))(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) plugins/search/plugin-search: dependencies: From 98e543d93ce61d1c9fea0f7931f820673c6e4266 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 22:48:10 +0800 Subject: [PATCH 31/46] fix: fix bugs --- .../search/plugin-meilisearch/package.json | 3 +- .../plugin-meilisearch/rollup.config.ts | 13 +++-- .../src/client/components/MeiliSearch.ts | 4 +- .../plugin-meilisearch/src/client/config.ts | 4 ++ .../plugin-meilisearch/src/client/shims.d.ts | 6 ++- .../src/client/styles/vars.css | 49 +++++++++++++++++++ .../plugin-register-components/package.json | 3 +- 7 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 plugins/search/plugin-meilisearch/src/client/styles/vars.css diff --git a/plugins/search/plugin-meilisearch/package.json b/plugins/search/plugin-meilisearch/package.json index 474b2433b9..5c9b0f0452 100644 --- a/plugins/search/plugin-meilisearch/package.json +++ b/plugins/search/plugin-meilisearch/package.json @@ -34,7 +34,8 @@ "scripts": { "build": "tsc -b tsconfig.build.json", "bundle": "rollup -c rollup.config.ts --configPlugin esbuild", - "clean": "rimraf --glob ./lib ./*.tsbuildinfo" + "clean": "rimraf --glob ./lib ./*.tsbuildinfo", + "style": "sass src:lib --embed-sources --style=compressed --pkg-importer=node" }, "dependencies": { "@vuepress/helper": "workspace:*", diff --git a/plugins/search/plugin-meilisearch/rollup.config.ts b/plugins/search/plugin-meilisearch/rollup.config.ts index 6d1d9fe49e..cb620b71a0 100644 --- a/plugins/search/plugin-meilisearch/rollup.config.ts +++ b/plugins/search/plugin-meilisearch/rollup.config.ts @@ -5,10 +5,17 @@ export default [ ...rollupBundle( { base: 'client', files: ['components/MeiliSearch', 'config'] }, { - external: ['meilisearch-docsearch', 'meilisearch-docsearch/css'], - dtsExternal: ['meilisearch-docsearch/css'], + external: [ + 'meilisearch-docsearch', + 'meilisearch-docsearch/css/button', + 'meilisearch-docsearch/css/modal', + ], + dtsExternal: [ + 'meilisearch-docsearch/css/button', + 'meilisearch-docsearch/css/modal', + ], moduleSideEffects: (id) => - id.endsWith('.css') || id === 'meilisearch-docsearch/css', + id.endsWith('.css') || id.startsWith('meilisearch-docsearch/css'), }, ), ] diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index 5c5743aa04..ef98d6af30 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -19,8 +19,6 @@ import type { import { getSearchButtonTemplate } from '../utils/getSearchButtonTemplate.js' -import 'meilisearch-docsearch/css' - export const MeiliSearch = defineComponent({ name: 'MeiliSearch', @@ -44,7 +42,7 @@ export const MeiliSearch = defineComponent({ const { locales = {}, ...rest } = props.options return { - ...locale.value, + translations: locale.value, ...locales[routeLocale.value], ...rest, } diff --git a/plugins/search/plugin-meilisearch/src/client/config.ts b/plugins/search/plugin-meilisearch/src/client/config.ts index 3382e9dbf1..bb98ff93a2 100644 --- a/plugins/search/plugin-meilisearch/src/client/config.ts +++ b/plugins/search/plugin-meilisearch/src/client/config.ts @@ -8,6 +8,10 @@ import type { } from '../shared/index.js' import { MeiliSearch } from './components/index.js' +import 'meilisearch-docsearch/css/button' +import 'meilisearch-docsearch/css/modal' +import './styles/vars.css' + declare const __ML_SEARCH_OPTIONS__: MeiliSearchOptions declare const __ML_SEARCH_LOCALES__: ExactLocaleConfig diff --git a/plugins/search/plugin-meilisearch/src/client/shims.d.ts b/plugins/search/plugin-meilisearch/src/client/shims.d.ts index 214f01e1d4..90f023a15c 100644 --- a/plugins/search/plugin-meilisearch/src/client/shims.d.ts +++ b/plugins/search/plugin-meilisearch/src/client/shims.d.ts @@ -1,3 +1,7 @@ -declare module 'meilisearch-docsearch/css' { +declare module 'meilisearch-docsearch/css/button' { + export {} +} + +declare module 'meilisearch-docsearch/css/modal' { export {} } diff --git a/plugins/search/plugin-meilisearch/src/client/styles/vars.css b/plugins/search/plugin-meilisearch/src/client/styles/vars.css new file mode 100644 index 0000000000..21341a5b83 --- /dev/null +++ b/plugins/search/plugin-meilisearch/src/client/styles/vars.css @@ -0,0 +1,49 @@ +/* src/styles/variables.css */ +:root { + --docsearch-primary-color: var(--vp-c-accent); + --docsearch-text-color: var(--vp-c-text); + --docsearch-spacing: 12px; + --docsearch-icon-stroke-width: 1.4; + --docsearch-highlight-color: var(--vp-c-accent); + --docsearch-muted-color: var(--vp-c-text-mute); + --docsearch-modal-width: 560px; + --docsearch-modal-height: 600px; + --docsearch-modal-background: var(--vp-c-bg-elv); + --docsearch-searchbox-height: 56px; + --docsearch-searchbox-background: var(--vp-c-grey-soft); + --docsearch-searchbox-focus-background: var(--vp-c-bg-elv); + --docsearch-searchbox-shadow: inset 0 0 0 2px var(--vp-c-accent-soft); + --docsearch-hit-height: 56px; + --docsearch-hit-color: var(--vp-c-text-mute); + --docsearch-hit-active-color: var(--vp-c-bg); + --docsearch-hit-background: var(--vp-c-bg); + --docsearch-hit-shadow: 0 1px 3px 0 var(--vp-c-border-hard); + --docsearch-footer-height: 44px; + --docsearch-footer-background: var(--vp-c-bg); + --docsearch-modal-shadow: + inset 1px 1px 0 0 rgb(255 255 255 / 50%), 0 3px 8px 0 rgb(85 90 100 / 100%); + --docsearch-modal-container-background: rgb(101 108 133 / 80%); + --docsearch-icon-color: rgb(21 21 21); + --docsearch-key-gradient: linear-gradient( + -225deg, + rgb(213 219 228) 0%, + rgb(248 248 248) 100% + ); + --docsearch-key-shadow: + inset 0 -2px 0 0 rgb(205 205 230), inset 0 0 1px 1px #fff, + 0 1px 2px 1px rgb(30 35 90 / 40%); + --docsearch-footer-shadow: + 0 -1px 0 0 rgb(224 227 232), 0 -3px 6px 0 rgb(69 98 155 / 12%); +} + +[data-theme='dark'] { + --docsearch-modal-container-background: rgb(9 10 17 / 80%); + --docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309; + --docsearch-key-gradient: linear-gradient(-225deg, #444950, #1c1e21); + --docsearch-key-shadow: + inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, + 0 2px 2px 0 rgb(3 4 9 / 30%); + --docsearch-footer-shadow: + inset 0 1px 0 0 rgb(73 76 106 / 50%), 0 -4px 8px 0 rgb(0 0 0 / 20%); + --docsearch-icon-color: rgb(255 255 255); +} diff --git a/plugins/tools/plugin-register-components/package.json b/plugins/tools/plugin-register-components/package.json index e8b84e4ad9..ef6f97490f 100644 --- a/plugins/tools/plugin-register-components/package.json +++ b/plugins/tools/plugin-register-components/package.json @@ -32,8 +32,7 @@ "scripts": { "build": "tsc -b tsconfig.build.json", "bundle": "rollup -c rollup.config.ts --configPlugin esbuild", - "clean": "rimraf --glob ./lib ./*.tsbuildinfo", - "copy": "cpx \"src/**/*.{css,svg}\" lib" + "clean": "rimraf --glob ./lib ./*.tsbuildinfo" }, "dependencies": { "chokidar": "^4.0.3" From d993c7cd9e0d9ee4808a8faeafc28a3d06a1e244 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 23:00:14 +0800 Subject: [PATCH 32/46] fix: fix vite pack issue --- .../plugin-meilisearch/rollup.config.ts | 29 +++++++++---------- .../src/node/meilisearchPlugin.ts | 12 +++++++- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/plugins/search/plugin-meilisearch/rollup.config.ts b/plugins/search/plugin-meilisearch/rollup.config.ts index cb620b71a0..9afed2b2da 100644 --- a/plugins/search/plugin-meilisearch/rollup.config.ts +++ b/plugins/search/plugin-meilisearch/rollup.config.ts @@ -2,20 +2,17 @@ import { rollupBundle } from '../../../scripts/rollup.js' export default [ ...rollupBundle('node/index', {}), - ...rollupBundle( - { base: 'client', files: ['components/MeiliSearch', 'config'] }, - { - external: [ - 'meilisearch-docsearch', - 'meilisearch-docsearch/css/button', - 'meilisearch-docsearch/css/modal', - ], - dtsExternal: [ - 'meilisearch-docsearch/css/button', - 'meilisearch-docsearch/css/modal', - ], - moduleSideEffects: (id) => - id.endsWith('.css') || id.startsWith('meilisearch-docsearch/css'), - }, - ), + ...rollupBundle('client/config', { + external: [ + 'meilisearch-docsearch', + 'meilisearch-docsearch/css/button', + 'meilisearch-docsearch/css/modal', + ], + dtsExternal: [ + 'meilisearch-docsearch/css/button', + 'meilisearch-docsearch/css/modal', + ], + moduleSideEffects: (id) => + id.endsWith('.css') || id.startsWith('meilisearch-docsearch/css'), + }), ] diff --git a/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts index 252ad80a0a..23bb72123a 100644 --- a/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts +++ b/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts @@ -1,4 +1,10 @@ -import { entries, fromEntries, getFullLocaleConfig } from '@vuepress/helper' +import { + addViteSsrExternal, + addViteSsrNoExternal, + entries, + fromEntries, + getFullLocaleConfig, +} from '@vuepress/helper' import type { Plugin } from 'vuepress' import { getDirname, path } from 'vuepress/utils' import type { MeiliSearchOptions } from '../shared/index.js' @@ -34,5 +40,9 @@ export const meilisearchPlugin = __ML_SEARCH_OPTIONS__: options, }, + extendsBundlerOptions: (bundlerOptions) => { + addViteSsrExternal(bundlerOptions, app, 'meilisearch-docsearch') + }, + clientConfigFile: path.resolve(__dirname, '../client/config.js'), }) From 399409e385648a57184d0b694baaa13488acebd5 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 23:04:46 +0800 Subject: [PATCH 33/46] chore: tweaks --- plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts b/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts index 23bb72123a..b7a0a79aa4 100644 --- a/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts +++ b/plugins/search/plugin-meilisearch/src/node/meilisearchPlugin.ts @@ -1,6 +1,5 @@ import { addViteSsrExternal, - addViteSsrNoExternal, entries, fromEntries, getFullLocaleConfig, From 029b937af6d541e1f29ac5571beef484efe80e8f Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 23:19:16 +0800 Subject: [PATCH 34/46] fix: fix webpack ssg --- .../plugin-meilisearch/src/client/components/MeiliSearch.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index ef98d6af30..76ea4575af 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -53,6 +53,8 @@ export const MeiliSearch = defineComponent({ let destroy: () => void const initialize = async (): Promise => { + if (__VUEPRESS_SSR__) return + const { docsearch } = await import('meilisearch-docsearch') destroy = docsearch({ From 36877cb6696967e753e2c96afd1344f0d9ad6c47 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 23:22:54 +0800 Subject: [PATCH 35/46] docs: update docs --- docs/plugins/search/meilisearch.md | 2 +- docs/zh/plugins/search/meilisearch.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 29aefddeec..7880f0dc34 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -205,7 +205,7 @@ meilisearchPlugin({ Parameters of MeiliSearch API. - Also see: - - [more](https://www.meilisearch.com/docs/reference/api/search#search-parameters) + - [Meilisearch API docs](https://www.meilisearch.com/docs/reference/api/search#search-parameters) ## Components diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 240c9dab86..671b423a8a 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -200,7 +200,7 @@ meilisearchPlugin({ - 详情: - - [更多](https://www.meilisearch.com/docs/reference/api/search#search-parameters) + - [Meilisearch API 文档](https://www.meilisearch.com/docs/reference/api/search#search-parameters) ## 组件 From 8d37fd73178edccc2cb6cbb79ecdf2260e258b09 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Sat, 12 Apr 2025 23:40:06 +0800 Subject: [PATCH 36/46] chore: tweaks --- plugins/features/plugin-medium-zoom/package.json | 2 +- .../src/client/styles/medium-zoom.css | 15 --------------- .../src/client/styles/medium-zoom.scss | 15 +++++++++++++++ .../src/client/styles/{vars.css => vars.scss} | 0 plugins/features/plugin-nprogress/package.json | 2 +- .../src/client/styles/nprogress.css | 15 --------------- .../src/client/styles/nprogress.scss | 15 +++++++++++++++ .../src/client/styles/{vars.css => vars.scss} | 0 plugins/search/plugin-docsearch/package.json | 2 +- .../styles/{docsearch.css => docsearch.scss} | 0 .../src/client/styles/{vars.css => vars.scss} | 0 11 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.css create mode 100644 plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.scss rename plugins/features/plugin-medium-zoom/src/client/styles/{vars.css => vars.scss} (100%) delete mode 100644 plugins/features/plugin-nprogress/src/client/styles/nprogress.css create mode 100644 plugins/features/plugin-nprogress/src/client/styles/nprogress.scss rename plugins/features/plugin-nprogress/src/client/styles/{vars.css => vars.scss} (100%) rename plugins/search/plugin-docsearch/src/client/styles/{docsearch.css => docsearch.scss} (100%) rename plugins/search/plugin-docsearch/src/client/styles/{vars.css => vars.scss} (100%) diff --git a/plugins/features/plugin-medium-zoom/package.json b/plugins/features/plugin-medium-zoom/package.json index e4da99e312..6d9b6be202 100644 --- a/plugins/features/plugin-medium-zoom/package.json +++ b/plugins/features/plugin-medium-zoom/package.json @@ -36,7 +36,7 @@ "build": "tsc -b tsconfig.build.json", "bundle": "rollup -c rollup.config.ts --configPlugin esbuild", "clean": "rimraf --glob ./lib ./*.tsbuildinfo", - "copy": "cpx \"src/**/*.css\" lib" + "style": "sass src:lib --embed-sources --style=compressed --pkg-importer=node" }, "dependencies": { "@vuepress/helper": "workspace:*", diff --git a/plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.css b/plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.css deleted file mode 100644 index 1ae204ffdc..0000000000 --- a/plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.css +++ /dev/null @@ -1,15 +0,0 @@ -.medium-zoom-overlay { - z-index: var(--medium-zoom-z-index); - - /* override element style set by medium-zoom script */ - background-color: var(--medium-zoom-c-bg) !important; -} - -.medium-zoom-overlay ~ img { - z-index: calc(var(--medium-zoom-z-index) + 1); -} - -/* stylelint-disable-next-line selector-class-pattern */ -.medium-zoom--opened .medium-zoom-overlay { - opacity: var(--medium-zoom-opacity); -} diff --git a/plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.scss b/plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.scss new file mode 100644 index 0000000000..199d732086 --- /dev/null +++ b/plugins/features/plugin-medium-zoom/src/client/styles/medium-zoom.scss @@ -0,0 +1,15 @@ +.medium-zoom-overlay { + z-index: var(--medium-zoom-z-index); + + /* override element style set by medium-zoom script */ + background-color: var(--medium-zoom-c-bg) !important; + + ~ img { + z-index: calc(var(--medium-zoom-z-index) + 1); + } + + /* stylelint-disable-next-line selector-class-pattern */ + .medium-zoom--opened & { + opacity: var(--medium-zoom-opacity); + } +} diff --git a/plugins/features/plugin-medium-zoom/src/client/styles/vars.css b/plugins/features/plugin-medium-zoom/src/client/styles/vars.scss similarity index 100% rename from plugins/features/plugin-medium-zoom/src/client/styles/vars.css rename to plugins/features/plugin-medium-zoom/src/client/styles/vars.scss diff --git a/plugins/features/plugin-nprogress/package.json b/plugins/features/plugin-nprogress/package.json index 14228bc2d5..0f895d38ae 100644 --- a/plugins/features/plugin-nprogress/package.json +++ b/plugins/features/plugin-nprogress/package.json @@ -34,7 +34,7 @@ "build": "tsc -b tsconfig.build.json", "bundle": "rollup -c rollup.config.ts --configPlugin esbuild", "clean": "rimraf --glob ./lib ./*.tsbuildinfo", - "copy": "cpx \"src/**/*.css\" lib" + "style": "sass src:lib --embed-sources --style=compressed --pkg-importer=node" }, "dependencies": { "@vuepress/helper": "workspace:*", diff --git a/plugins/features/plugin-nprogress/src/client/styles/nprogress.css b/plugins/features/plugin-nprogress/src/client/styles/nprogress.css deleted file mode 100644 index a405413d18..0000000000 --- a/plugins/features/plugin-nprogress/src/client/styles/nprogress.css +++ /dev/null @@ -1,15 +0,0 @@ -#nprogress { - pointer-events: none; -} - -#nprogress .bar { - position: fixed; - top: 0; - left: 0; - z-index: var(--nprogress-z-index); - - width: 100%; - height: 2px; - - background: var(--nprogress-c); -} diff --git a/plugins/features/plugin-nprogress/src/client/styles/nprogress.scss b/plugins/features/plugin-nprogress/src/client/styles/nprogress.scss new file mode 100644 index 0000000000..62b87572d0 --- /dev/null +++ b/plugins/features/plugin-nprogress/src/client/styles/nprogress.scss @@ -0,0 +1,15 @@ +#nprogress { + pointer-events: none; + + .bar { + position: fixed; + top: 0; + left: 0; + z-index: var(--nprogress-z-index); + + width: 100%; + height: 2px; + + background: var(--nprogress-c); + } +} diff --git a/plugins/features/plugin-nprogress/src/client/styles/vars.css b/plugins/features/plugin-nprogress/src/client/styles/vars.scss similarity index 100% rename from plugins/features/plugin-nprogress/src/client/styles/vars.css rename to plugins/features/plugin-nprogress/src/client/styles/vars.scss diff --git a/plugins/search/plugin-docsearch/package.json b/plugins/search/plugin-docsearch/package.json index 21a2e84c08..f3475a1da2 100644 --- a/plugins/search/plugin-docsearch/package.json +++ b/plugins/search/plugin-docsearch/package.json @@ -37,7 +37,7 @@ "build": "tsc -b tsconfig.build.json", "bundle": "rollup -c rollup.config.ts --configPlugin esbuild", "clean": "rimraf --glob ./lib ./*.tsbuildinfo", - "copy": "cpx \"src/**/*.css\" lib" + "style": "sass src:lib --embed-sources --style=compressed --pkg-importer=node" }, "dependencies": { "@docsearch/css": "^3.9.0", diff --git a/plugins/search/plugin-docsearch/src/client/styles/docsearch.css b/plugins/search/plugin-docsearch/src/client/styles/docsearch.scss similarity index 100% rename from plugins/search/plugin-docsearch/src/client/styles/docsearch.css rename to plugins/search/plugin-docsearch/src/client/styles/docsearch.scss diff --git a/plugins/search/plugin-docsearch/src/client/styles/vars.css b/plugins/search/plugin-docsearch/src/client/styles/vars.scss similarity index 100% rename from plugins/search/plugin-docsearch/src/client/styles/vars.css rename to plugins/search/plugin-docsearch/src/client/styles/vars.scss From 72c8f40d58f4d32f77144d59303ebd2c2b90b161 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 14 Apr 2025 11:53:58 +0800 Subject: [PATCH 37/46] feat: filter results based on page locale --- .../plugin-meilisearch/src/client/components/MeiliSearch.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index 76ea4575af..9000fc2d18 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -9,7 +9,7 @@ import { ref, watch, } from 'vue' -import { useRouteLocale } from 'vuepress/client' +import { usePageLang, useRouteLocale } from 'vuepress/client' import type { LocaleConfig } from 'vuepress/shared' import type { @@ -37,6 +37,7 @@ export const MeiliSearch = defineComponent({ setup(props) { const locale = useLocaleConfig(props.locales) const routeLocale = useRouteLocale() + const lang = usePageLang() const meilisearchOptions = computed(() => { const { locales = {}, ...rest } = props.options @@ -59,6 +60,9 @@ export const MeiliSearch = defineComponent({ destroy = docsearch({ ...meilisearchOptions.value, + searchParams: { + filter: [`lang=${lang.value}`], + }, container: '#docsearch', }) From fa9a3190f30052505add0bbc41335e0fad2ff604 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 14 Apr 2025 12:06:25 +0800 Subject: [PATCH 38/46] docs: update docs --- docs/plugins/search/meilisearch.md | 57 +++++++++++++++++++++++++- docs/zh/plugins/search/meilisearch.md | 59 ++++++++++++++++++++++++++- 2 files changed, 112 insertions(+), 4 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 7880f0dc34..9031dc5536 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -54,7 +54,7 @@ MeiliSearch provides a Docker crawler to crawl documents. Until then, make sure Here is a sample configuration for grabbing the official VuePress documentation, saved locally: -```json +```json{18-68} { "index_uid": "YOUR_INDEX_NAME", "start_urls": ["https://YOUR_WEBSITE_URL/"], @@ -71,11 +71,64 @@ Here is a sample configuration for grabbing the official VuePress documentation, "lvl4": "[vp-content] h4", "lvl5": "[vp-content] h5", "lvl6": "[vp-content] h6", - "content": "[vp-content] p, [vp-content] li" + "content": "[vp-content] p, [vp-content] li", + "lang": { + "selector": "/html/@lang", + "global": true, + "type": "xpath" + } + }, + "custom_settings": { + "searchableAttributes": [ + "hierarchy_radio_lvl0", + "hierarchy_radio_lvl1", + "hierarchy_radio_lvl2", + "hierarchy_radio_lvl3", + "hierarchy_radio_lvl4", + "hierarchy_radio_lvl5", + "hierarchy_lvl0", + "hierarchy_lvl1", + "hierarchy_lvl2", + "hierarchy_lvl3", + "hierarchy_lvl4", + "hierarchy_lvl5", + "hierarchy_lvl6", + "content", + "lang", + "objectID", + "page_rank", + "level", + "position" + ], + "displayedAttributes": [ + "hierarchy_radio_lvl0", + "hierarchy_radio_lvl1", + "hierarchy_radio_lvl2", + "hierarchy_radio_lvl3", + "hierarchy_radio_lvl4", + "hierarchy_radio_lvl5", + "hierarchy_lvl0", + "hierarchy_lvl1", + "hierarchy_lvl2", + "hierarchy_lvl3", + "hierarchy_lvl4", + "hierarchy_lvl5", + "hierarchy_lvl6", + "anchor", + "url", + "lang", + "content", + "objectID" + ], + "filterableAttributes": ["lang"] } } ``` +::: info +You can modify them according to the theme you are using. However, do not change the configuration of lines 18 through 68, or the plugin may not work. +::: + Start scraping the document, `MEILISEARCH_HOST_URL` is the address of the host running MeiliSearch, `` is the master key, `` is the absolute path to fetch the configuration file: ```sh diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 671b423a8a..1b55ca9b40 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -54,7 +54,7 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 这是抓取 VuePress 官方文档的示例配置,保存在本地: -```json +```json{18-68} { "index_uid": "YOUR_INDEX_NAME", "start_urls": ["https://YOUR_WEBSITE_URL/"], @@ -71,11 +71,66 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 "lvl4": "[vp-content] h4", "lvl5": "[vp-content] h5", "lvl6": "[vp-content] h6", - "content": "[vp-content] p, [vp-content] li" + "content": "[vp-content] p, [vp-content] li", + "lang": { + "selector": "/html/@lang", + "global": true, + "type": "xpath" + } + }, + "custom_settings": { + "searchableAttributes": [ + "hierarchy_radio_lvl0", + "hierarchy_radio_lvl1", + "hierarchy_radio_lvl2", + "hierarchy_radio_lvl3", + "hierarchy_radio_lvl4", + "hierarchy_radio_lvl5", + "hierarchy_lvl0", + "hierarchy_lvl1", + "hierarchy_lvl2", + "hierarchy_lvl3", + "hierarchy_lvl4", + "hierarchy_lvl5", + "hierarchy_lvl6", + "content", + "lang", + "objectID", + "page_rank", + "level", + "position" + ], + "displayedAttributes": [ + "hierarchy_radio_lvl0", + "hierarchy_radio_lvl1", + "hierarchy_radio_lvl2", + "hierarchy_radio_lvl3", + "hierarchy_radio_lvl4", + "hierarchy_radio_lvl5", + "hierarchy_lvl0", + "hierarchy_lvl1", + "hierarchy_lvl2", + "hierarchy_lvl3", + "hierarchy_lvl4", + "hierarchy_lvl5", + "hierarchy_lvl6", + "anchor", + "url", + "lang", + "content", + "objectID" + ], + "filterableAttributes": ["lang"] } } ``` +::: info + +你可以根据你正在使用的主题修改它们。但是,18 到 68 行的配置不要更改,否则插件可能无法工作 + +::: + 开始抓取文档,`MEILISEARCH_HOST_URL`是运行 MeiliSearch 的主机地址,``是主密钥,``是抓取配置文件的绝对路径: ```sh From 11dedde79d1ac4d33688f58eee6d6e3aef6ba31c Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 14 Apr 2025 12:36:38 +0800 Subject: [PATCH 39/46] docs: update docs --- docs/plugins/search/meilisearch.md | 2 +- docs/zh/plugins/search/meilisearch.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 9031dc5536..3f9d15b071 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -126,7 +126,7 @@ Here is a sample configuration for grabbing the official VuePress documentation, ``` ::: info -You can modify them according to the theme you are using. However, do not change the configuration of lines 18 through 68, or the plugin may not work. +You're welcome to customize the configuration settings for your theme. Just be sure to keep lines 18 through 68 as they are. You can add other fields to `filterableAttributes`, but the `lang` field is required; otherwise, the plugin may not work. ::: Start scraping the document, `MEILISEARCH_HOST_URL` is the address of the host running MeiliSearch, `` is the master key, `` is the absolute path to fetch the configuration file: diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 1b55ca9b40..0b02fcf7f3 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -127,7 +127,7 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 ::: info -你可以根据你正在使用的主题修改它们。但是,18 到 68 行的配置不要更改,否则插件可能无法工作 +你可以根据你正在使用的主题修改它们。但是,18 到 68 行的配置不要更改,你可以添加其他字段到`filterableAttributes`中,但是必须包含`lang`字段,否则插件可能无法工作 ::: From 5ed8ec7b1961f72cbe5d73efea7fd72dd82fc4fc Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 14 Apr 2025 14:27:10 +0800 Subject: [PATCH 40/46] fix: fixed an issue where filters could not be passed to options --- .../src/client/components/MeiliSearch.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts index 9000fc2d18..7f679dc42b 100644 --- a/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts +++ b/plugins/search/plugin-meilisearch/src/client/components/MeiliSearch.ts @@ -57,11 +57,23 @@ export const MeiliSearch = defineComponent({ if (__VUEPRESS_SSR__) return const { docsearch } = await import('meilisearch-docsearch') + const { searchParams } = meilisearchOptions.value + let rawFilter: (string[] | string)[] = [] + + if (searchParams?.filter) { + if (typeof searchParams.filter === 'string') { + rawFilter.push(searchParams.filter) + } else if (Array.isArray(searchParams.filter)) { + rawFilter = searchParams.filter + } + } + const filter = [`lang=${lang.value}`, ...rawFilter] destroy = docsearch({ ...meilisearchOptions.value, searchParams: { - filter: [`lang=${lang.value}`], + ...meilisearchOptions.value.searchParams, + filter, }, container: '#docsearch', }) From f8fd164be7723b91f58223deefb9f2e448c1ef1e Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Mon, 14 Apr 2025 16:05:51 +0800 Subject: [PATCH 41/46] docs: update docs --- docs/plugins/search/meilisearch.md | 13 +++++++++++-- docs/zh/plugins/search/meilisearch.md | 17 ++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 3f9d15b071..297372f6c3 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -54,7 +54,7 @@ MeiliSearch provides a Docker crawler to crawl documents. Until then, make sure Here is a sample configuration for grabbing the official VuePress documentation, saved locally: -```json{18-68} +```json {18-68} { "index_uid": "YOUR_INDEX_NAME", "start_urls": ["https://YOUR_WEBSITE_URL/"], @@ -126,7 +126,16 @@ Here is a sample configuration for grabbing the official VuePress documentation, ``` ::: info -You're welcome to customize the configuration settings for your theme. Just be sure to keep lines 18 through 68 as they are. You can add other fields to `filterableAttributes`, but the `lang` field is required; otherwise, the plugin may not work. + +`start_urls` and `sitemap_urls` (optional) shall be customized according to the website to be crawled. + +`selectors` field can be customized according to third-party theme DOM structure. + +To let the plugin work: + +- `lang` selector must be kept as is in `selectors` filed +- All fields that are currently in `custom_settings` must not be removed. + ::: Start scraping the document, `MEILISEARCH_HOST_URL` is the address of the host running MeiliSearch, `` is the master key, `` is the absolute path to fetch the configuration file: diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 0b02fcf7f3..d3d97b2d1c 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -54,7 +54,7 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 这是抓取 VuePress 官方文档的示例配置,保存在本地: -```json{18-68} +```json {18-68} { "index_uid": "YOUR_INDEX_NAME", "start_urls": ["https://YOUR_WEBSITE_URL/"], @@ -127,11 +127,18 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 ::: info -你可以根据你正在使用的主题修改它们。但是,18 到 68 行的配置不要更改,你可以添加其他字段到`filterableAttributes`中,但是必须包含`lang`字段,否则插件可能无法工作 +`start_urls` 和 `sitemap_urls`(可选)应根据要抓取的网站进行自定义。 + +`selectors` 字段可以根据第三方 DOM 结构进行自定义。 + +为了让插件工作: + +- `lang` 选择器必须在 `selectors` 字段中保持不变 +- `custom_settings` 中当前的所有字段都不能删除。 ::: -开始抓取文档,`MEILISEARCH_HOST_URL`是运行 MeiliSearch 的主机地址,``是主密钥,``是抓取配置文件的绝对路径: +开始抓取文档,`MEILISEARCH_HOST_URL` 是运行 MeiliSearch 的主机地址,`` 是主密钥,`` 是抓取配置文件的绝对路径: ```sh docker run -t --rm \ @@ -146,9 +153,9 @@ docker run -t --rm \ > 参考 -## 获取搜索索引和 apikey +## 获取搜索索引和 API 密钥 -要创建只允许搜索操作的访问密钥,请使用以下请求。`indexes`数组指定该密钥可以访问哪些索引,`expiresAt`设置密钥的过期时间。 +要创建只允许搜索操作的访问密钥,请使用以下请求。`indexes` 数组指定该密钥可以访问哪些索引,`expiresAt` 设置密钥的过期时间。 ```sh curl \ From d7f4c87b706efcdf1bc620c02c395001945f0dcb Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Mon, 14 Apr 2025 16:09:41 +0800 Subject: [PATCH 42/46] docs: update docs --- docs/plugins/search/meilisearch.md | 2 +- docs/zh/plugins/search/meilisearch.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 297372f6c3..65509c803d 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -52,7 +52,7 @@ docker run -it --rm \ MeiliSearch provides a Docker crawler to crawl documents. Until then, make sure MeiliSearch is running. -Here is a sample configuration for grabbing the official VuePress documentation, saved locally: +Here is a sample of crawler configuration, which you should save, modify and pass to the crawler: ```json {18-68} { diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index d3d97b2d1c..44808b2775 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -52,7 +52,7 @@ docker run -it --rm \ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 MeiliSearch 已经运行。 -这是抓取 VuePress 官方文档的示例配置,保存在本地: +这是一个爬虫配置的示例,你应该保存、修改并传递给爬虫: ```json {18-68} { From c5766d870392180a7ec5d2b48ce050578181e5fa Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Mon, 14 Apr 2025 16:10:44 +0800 Subject: [PATCH 43/46] docs: tweaks --- docs/plugins/search/meilisearch.md | 2 +- docs/zh/plugins/search/meilisearch.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index 65509c803d..ea92859500 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -54,7 +54,7 @@ MeiliSearch provides a Docker crawler to crawl documents. Until then, make sure Here is a sample of crawler configuration, which you should save, modify and pass to the crawler: -```json {18-68} +```json { "index_uid": "YOUR_INDEX_NAME", "start_urls": ["https://YOUR_WEBSITE_URL/"], diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 44808b2775..1538cdb4d5 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -54,7 +54,7 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 这是一个爬虫配置的示例,你应该保存、修改并传递给爬虫: -```json {18-68} +```json { "index_uid": "YOUR_INDEX_NAME", "start_urls": ["https://YOUR_WEBSITE_URL/"], From 7857601b573e2f5c9403b82f700c10360af83533 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Mon, 14 Apr 2025 16:14:25 +0800 Subject: [PATCH 44/46] docs: tweaks --- docs/plugins/search/meilisearch.md | 8 ++++---- docs/zh/plugins/search/meilisearch.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index ea92859500..bab0fbdc26 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -125,11 +125,11 @@ Here is a sample of crawler configuration, which you should save, modify and pas } ``` -::: info +- `start_urls` and `sitemap_urls` (optional) shall be customized according to the website to be crawled. +- `selectors` field can be customized according to third-party theme DOM structure. +- You can add new fields to `custom_settings` according to your needs. -`start_urls` and `sitemap_urls` (optional) shall be customized according to the website to be crawled. - -`selectors` field can be customized according to third-party theme DOM structure. +::: important To let the plugin work: diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 1538cdb4d5..511d54fae8 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -125,11 +125,11 @@ MeiliSearch 提供了一个 Docker 爬虫来抓取文档。在此之前,保证 } ``` -::: info +- `start_urls` 和 `sitemap_urls`(可选)应根据要抓取的网站进行自定义。 +- `selectors` 字段可以根据第三方 DOM 结构进行自定义。 +- 你可以根据需要向 `custom_settings` 添加新字段。 -`start_urls` 和 `sitemap_urls`(可选)应根据要抓取的网站进行自定义。 - -`selectors` 字段可以根据第三方 DOM 结构进行自定义。 +::: important 为了让插件工作: From 47ff3cf6bf11143b9a7f6138b99b0e8685355766 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 14 Apr 2025 16:51:12 +0800 Subject: [PATCH 45/46] docs: update docs --- docs/plugins/search/meilisearch.md | 29 ++++++++++++++++++++++++++ docs/zh/plugins/search/meilisearch.md | 30 +++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index bab0fbdc26..e67712cd22 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -153,6 +153,35 @@ When the crawl is complete, MeiliSearch stores the crawled document in the speci > See +### Using Github Action for Automatic Scraping + +In the Github repository, go to `Settings` -> `Secrets and variables` -> `Actions` -> `New repository secret` to set `MEILISEARCH_API_KEY`. And name your scraper configuration file `meilisearch_scraper.json` and place it in the root directory of your project. + +```yml +name: Deploy and Scrape + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + deploy-gh-pages: + runs-on: ubuntu-latest + steps: + # .... + - name: Crawl the article content and rebuild the meilisearch index + run: |- + docker run -t --rm \ + -e MEILISEARCH_HOST_URL='https://meilisearch.example.com' \ + -e MEILISEARCH_API_KEY='${{ secrets.MEILISEARCH_API_KEY }}' \ + -v ${{ github.workspace }}/melisearch_scraper.json:/docs-scraper/config.json \ + getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json +``` + ## Get search index and api key To create an access key that only allows search operations, use the following request. The `indexes` array specifies which indexes this key can access, and `expiresAt` sets the key's expiration date. diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 511d54fae8..27971e4eaa 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -153,6 +153,36 @@ docker run -t --rm \ > 参考 +### 使用 Github Action 自动抓取 + +在 Github 仓库的`Settings` -> `Secrets and variables` -> `Actions` -> `New repository secret`设置`MEILISEARCH_API_KEY`,并将你的爬虫配置文件命名为 `melisearch_scraper.json` 放到项目根目录下。 + +```yml +name: Deploy and Scrape + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + deploy-gh-pages: + runs-on: ubuntu-latest + steps: + # .... + + - name: Crawl the article content and rebuild the meilisearch index + run: |- + docker run -t --rm \ + -e MEILISEARCH_HOST_URL='https://meilisearch.example.com' \ + -e MEILISEARCH_API_KEY='${{ secrets.MEILISEARCH_API_KEY }}' \ + -v ${{ github.workspace }}/melisearch_scraper.json:/docs-scraper/config.json \ + getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json +``` + ## 获取搜索索引和 API 密钥 要创建只允许搜索操作的访问密钥,请使用以下请求。`indexes` 数组指定该密钥可以访问哪些索引,`expiresAt` 设置密钥的过期时间。 From 00f964639a34f7276518c70721c55a5e889768a0 Mon Sep 17 00:00:00 2001 From: JQiue <861947542@qq.com> Date: Mon, 14 Apr 2025 19:33:51 +0800 Subject: [PATCH 46/46] docs: update docs --- docs/plugins/search/meilisearch.md | 27 ++++++++++++++++---------- docs/zh/plugins/search/meilisearch.md | 28 ++++++++++++++++----------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/docs/plugins/search/meilisearch.md b/docs/plugins/search/meilisearch.md index e67712cd22..ebccdb18e3 100644 --- a/docs/plugins/search/meilisearch.md +++ b/docs/plugins/search/meilisearch.md @@ -155,7 +155,7 @@ When the crawl is complete, MeiliSearch stores the crawled document in the speci ### Using Github Action for Automatic Scraping -In the Github repository, go to `Settings` -> `Secrets and variables` -> `Actions` -> `New repository secret` to set `MEILISEARCH_API_KEY`. And name your scraper configuration file `meilisearch_scraper.json` and place it in the root directory of your project. +In the Github repository, go to `Settings` -> `Secrets and variables` -> `Actions` -> `New repository secret` to set `MEILISEARCH_API_KEY` and `MEILISEARCH_HOST_URL`. And name your scraper configuration file `meilisearch-scraper.json` and place it in the root directory of your project. ```yml name: Deploy and Scrape @@ -165,20 +165,27 @@ on: branches: - main -permissions: - contents: write - jobs: - deploy-gh-pages: + deploy: runs-on: ubuntu-latest steps: # .... - - name: Crawl the article content and rebuild the meilisearch index - run: |- + scrapy: + needs: deploy + runs-on: ubuntu-latest + name: scrape and push content on Meilisearch instance + steps: + - uses: actions/checkout@v4 + - name: Run scraper + env: + HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }} + API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} + CONFIG_FILE_PATH: ${{ github.workspace }}/meilisearch-scraper.json + run: | docker run -t --rm \ - -e MEILISEARCH_HOST_URL='https://meilisearch.example.com' \ - -e MEILISEARCH_API_KEY='${{ secrets.MEILISEARCH_API_KEY }}' \ - -v ${{ github.workspace }}/melisearch_scraper.json:/docs-scraper/config.json \ + -e MEILISEARCH_HOST_URL=$HOST_URL \ + -e MEILISEARCH_API_KEY=$API_KEY \ + -v $CONFIG_FILE_PATH:/docs-scraper/config.json \ getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json ``` diff --git a/docs/zh/plugins/search/meilisearch.md b/docs/zh/plugins/search/meilisearch.md index 27971e4eaa..9b0af2f76a 100644 --- a/docs/zh/plugins/search/meilisearch.md +++ b/docs/zh/plugins/search/meilisearch.md @@ -155,7 +155,7 @@ docker run -t --rm \ ### 使用 Github Action 自动抓取 -在 Github 仓库的`Settings` -> `Secrets and variables` -> `Actions` -> `New repository secret`设置`MEILISEARCH_API_KEY`,并将你的爬虫配置文件命名为 `melisearch_scraper.json` 放到项目根目录下。 +在 Github 仓库的`Settings` -> `Secrets and variables` -> `Actions` -> `New repository secret`设置`MEILISEARCH_API_KEY`和`MEILISEARCH_HOST_URL`,并将你的爬虫配置文件命名为 `melisearch_scraper.json` 放到项目根目录下。 ```yml name: Deploy and Scrape @@ -165,21 +165,27 @@ on: branches: - main -permissions: - contents: write - jobs: - deploy-gh-pages: + deploy: runs-on: ubuntu-latest steps: # .... - - - name: Crawl the article content and rebuild the meilisearch index - run: |- + scrapy: + needs: deploy + runs-on: ubuntu-latest + name: scrape and push content on Meilisearch instance + steps: + - uses: actions/checkout@v4 + - name: Run scraper + env: + HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }} + API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} + CONFIG_FILE_PATH: ${{ github.workspace }}/meilisearch-scraper.json + run: | docker run -t --rm \ - -e MEILISEARCH_HOST_URL='https://meilisearch.example.com' \ - -e MEILISEARCH_API_KEY='${{ secrets.MEILISEARCH_API_KEY }}' \ - -v ${{ github.workspace }}/melisearch_scraper.json:/docs-scraper/config.json \ + -e MEILISEARCH_HOST_URL=$HOST_URL \ + -e MEILISEARCH_API_KEY=$API_KEY \ + -v $CONFIG_FILE_PATH:/docs-scraper/config.json \ getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json ```