chore: update docsearch

pull/1136/head
Divyansh Singh 3 years ago
parent 6adf9b4101
commit 1d097ce5ad

@ -31,26 +31,13 @@ $ yarn add --dev vitepress vue
::: details Getting missing peer deps warnings? ::: details Getting missing peer deps warnings?
`@docsearch/js` has certain issues with its peer dependencies. If you see some commands failing due to them, you can try this workaround for now: `@docsearch/js` has certain issues with its peer dependencies. If you see some commands failing due to them, you can try this workaround for now:
On Yarn v2/v3, add this inside your rc file (`.yarnrc.yml` by default): If using PNPM, add this in your `package.json`:
```yaml
packageExtensions:
'@docsearch/react@*':
peerDependenciesMeta:
'@types/react':
optional: true
'react':
optional: true
'react-dom':
optional: true
```
On PNPM, add this in your `package.json`:
```json ```json
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {
"ignoreMissing": [ "ignoreMissing": [
"@algolia/client-search",
"@types/react", "@types/react",
"react", "react",
"react-dom" "react-dom"

@ -51,7 +51,7 @@
"dev-watch": "node scripts/watchAndCopy", "dev-watch": "node scripts/watchAndCopy",
"build": "run-s build-prepare build-client build-node", "build": "run-s build-prepare build-client build-node",
"build-prepare": "rimraf dist && node scripts/copyShared", "build-prepare": "rimraf dist && node scripts/copyShared",
"build-client": "tsc -p src/client && node scripts/copyClient", "build-client": "vue-tsc --noEmit -p src/client && tsc -p src/client && node scripts/copyClient",
"build-node": "rollup --config rollup.config.ts --configPlugin esbuild", "build-node": "rollup --config rollup.config.ts --configPlugin esbuild",
"format": "prettier --check --write .", "format": "prettier --check --write .",
"format-fail": "prettier --check .", "format-fail": "prettier --check .",
@ -71,10 +71,10 @@
"ci-docs": "run-s docs-build" "ci-docs": "run-s docs-build"
}, },
"dependencies": { "dependencies": {
"@docsearch/css": "^3.1.0", "@docsearch/css": "^3.1.1",
"@docsearch/js": "^3.1.0", "@docsearch/js": "^3.1.1",
"@vitejs/plugin-vue": "^3.0.0-beta.0", "@vitejs/plugin-vue": "^3.0.0-beta.0",
"@vue/devtools-api": "^6.1.4", "@vue/devtools-api": "^6.2.0",
"@vueuse/core": "^8.7.5", "@vueuse/core": "^8.7.5",
"body-scroll-lock": "^4.0.0-beta.0", "body-scroll-lock": "^4.0.0-beta.0",
"shiki": "^0.10.1", "shiki": "^0.10.1",
@ -138,11 +138,13 @@
"sirv": "^2.0.2", "sirv": "^2.0.2",
"supports-color": "^9.2.2", "supports-color": "^9.2.2",
"typescript": "^4.7.4", "typescript": "^4.7.4",
"vitest": "^0.16.0" "vitest": "^0.16.0",
"vue-tsc": "^0.38.2"
}, },
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {
"ignoreMissing": [ "ignoreMissing": [
"@algolia/client-search",
"@types/react", "@types/react",
"react", "react",
"react-dom" "react-dom"

@ -4,8 +4,8 @@ importers:
.: .:
specifiers: specifiers:
'@docsearch/css': ^3.1.0 '@docsearch/css': ^3.1.1
'@docsearch/js': ^3.1.0 '@docsearch/js': ^3.1.1
'@rollup/plugin-alias': ^3.1.9 '@rollup/plugin-alias': ^3.1.9
'@rollup/plugin-commonjs': ^22.0.1 '@rollup/plugin-commonjs': ^22.0.1
'@rollup/plugin-json': ^4.1.0 '@rollup/plugin-json': ^4.1.0
@ -25,7 +25,7 @@ importers:
'@types/polka': ^0.5.4 '@types/polka': ^0.5.4
'@types/prompts': ^2.0.14 '@types/prompts': ^2.0.14
'@vitejs/plugin-vue': ^3.0.0-beta.0 '@vitejs/plugin-vue': ^3.0.0-beta.0
'@vue/devtools-api': ^6.1.4 '@vue/devtools-api': ^6.2.0
'@vueuse/core': ^8.7.5 '@vueuse/core': ^8.7.5
body-scroll-lock: ^4.0.0-beta.0 body-scroll-lock: ^4.0.0-beta.0
chokidar: ^3.5.3 chokidar: ^3.5.3
@ -70,11 +70,12 @@ importers:
vite: ^3.0.0-beta.0 vite: ^3.0.0-beta.0
vitest: ^0.16.0 vitest: ^0.16.0
vue: ^3.2.37 vue: ^3.2.37
vue-tsc: ^0.38.2
dependencies: dependencies:
'@docsearch/css': 3.1.0 '@docsearch/css': 3.1.1
'@docsearch/js': 3.1.0 '@docsearch/js': 3.1.1
'@vitejs/plugin-vue': 3.0.0-beta.0_hrw2jqbpnmgiltw2su6c7ud5mq '@vitejs/plugin-vue': 3.0.0-beta.0_hrw2jqbpnmgiltw2su6c7ud5mq
'@vue/devtools-api': 6.1.4 '@vue/devtools-api': 6.2.0
'@vueuse/core': 8.7.5_vue@3.2.37 '@vueuse/core': 8.7.5_vue@3.2.37
body-scroll-lock: 4.0.0-beta.0 body-scroll-lock: 4.0.0-beta.0
shiki: 0.10.1 shiki: 0.10.1
@ -138,6 +139,7 @@ importers:
supports-color: 9.2.2 supports-color: 9.2.2
typescript: 4.7.4 typescript: 4.7.4
vitest: 0.16.0_supports-color@9.2.2 vitest: 0.16.0_supports-color@9.2.2
vue-tsc: 0.38.2_typescript@4.7.4
docs: docs:
specifiers: {} specifiers: {}
@ -150,14 +152,27 @@ importers:
packages: packages:
/@algolia/autocomplete-core/1.6.3: /@algolia/autocomplete-core/1.7.1:
resolution: {integrity: sha512-dqQqRt01fX3YuVFrkceHsoCnzX0bLhrrg8itJI1NM68KjrPYQPYsE+kY8EZTCM4y8VDnhqJErR73xe/ZsV+qAA==} resolution: {integrity: sha512-eiZw+fxMzNQn01S8dA/hcCpoWCOCwcIIEUtHHdzN5TGB3IpzLbuhqFeTfh2OUhhgkE8Uo17+wH+QJ/wYyQmmzg==}
dependencies: dependencies:
'@algolia/autocomplete-shared': 1.6.3 '@algolia/autocomplete-shared': 1.7.1
dev: false dev: false
/@algolia/autocomplete-shared/1.6.3: /@algolia/autocomplete-preset-algolia/1.7.1_algoliasearch@4.11.0:
resolution: {integrity: sha512-UV46bnkTztyADFaETfzFC5ryIdGVb2zpAoYgu0tfcuYWjhg1KbLXveFffZIrGVoboqmAk1b+jMrl6iCja1i3lg==} resolution: {integrity: sha512-pJwmIxeJCymU1M6cGujnaIYcY3QPOVYZOXhFkWVM7IxKzy272BwCvMFMyc5NpG/QmiObBxjo7myd060OeTNJXg==}
peerDependencies:
'@algolia/client-search': ^4.9.1
algoliasearch: ^4.9.1
peerDependenciesMeta:
'@algolia/client-search':
optional: true
dependencies:
'@algolia/autocomplete-shared': 1.7.1
algoliasearch: 4.11.0
dev: false
/@algolia/autocomplete-shared/1.7.1:
resolution: {integrity: sha512-eTmGVqY3GeyBTT8IWiB2K5EuURAqhnumfktAEoHxfDY2o7vg2rSnO16ZtIG0fMgt3py28Vwgq42/bVEuaQV7pg==}
dev: false dev: false
/@algolia/cache-browser-local-storage/4.11.0: /@algolia/cache-browser-local-storage/4.11.0:
@ -282,7 +297,6 @@ packages:
hasBin: true hasBin: true
dependencies: dependencies:
'@babel/types': 7.17.12 '@babel/types': 7.17.12
dev: false
/@babel/types/7.17.12: /@babel/types/7.17.12:
resolution: {integrity: sha512-rH8i29wcZ6x9xjzI5ILHL/yZkbQnCERdHlogKuIb4PUr7do4iT8DPekrTbBLWTnRQm6U0GYABbTMSzijmEqlAg==} resolution: {integrity: sha512-rH8i29wcZ6x9xjzI5ILHL/yZkbQnCERdHlogKuIb4PUr7do4iT8DPekrTbBLWTnRQm6U0GYABbTMSzijmEqlAg==}
@ -290,25 +304,25 @@ packages:
dependencies: dependencies:
'@babel/helper-validator-identifier': 7.16.7 '@babel/helper-validator-identifier': 7.16.7
to-fast-properties: 2.0.0 to-fast-properties: 2.0.0
dev: false
/@docsearch/css/3.1.0: /@docsearch/css/3.1.1:
resolution: {integrity: sha512-bh5IskwkkodbvC0FzSg1AxMykfDl95hebEKwxNoq4e5QaGzOXSBgW8+jnMFZ7JU4sTBiB04vZWoUSzNrPboLZA==} resolution: {integrity: sha512-utLgg7E1agqQeqCJn05DWC7XXMk4tMUUnL7MZupcknRu2OzGN13qwey2qA/0NAKkVBGugiWtON0+rlU0QIPojg==}
dev: false dev: false
/@docsearch/js/3.1.0: /@docsearch/js/3.1.1:
resolution: {integrity: sha512-5XSK+xbP0hcTIp54MECqxkWLs6kf7Ug4nWdxWNtx8cUpLiFNFnKXDxCb35wnyNpjukmrx7Q9DkO5tFFsmNVxng==} resolution: {integrity: sha512-bt7l2aKRoSnLUuX+s4LVQ1a7AF2c9myiZNv5uvQCePG5tpvVGpwrnMwqVXOUJn9q6FwVVhOrQMO/t+QmnnAEUw==}
dependencies: dependencies:
'@docsearch/react': 3.1.0 '@docsearch/react': 3.1.1
preact: 10.5.15 preact: 10.5.15
transitivePeerDependencies: transitivePeerDependencies:
- '@algolia/client-search'
- '@types/react' - '@types/react'
- react - react
- react-dom - react-dom
dev: false dev: false
/@docsearch/react/3.1.0: /@docsearch/react/3.1.1:
resolution: {integrity: sha512-bjB6ExnZzf++5B7Tfoi6UXgNwoUnNOfZ1NyvnvPhWgCMy5V/biAtLL4o7owmZSYdAKeFSvZ5Lxm0is4su/dBWg==} resolution: {integrity: sha512-cfoql4qvtsVRqBMYxhlGNpvyy/KlCoPqjIsJSZYqYf9AplZncKjLBTcwBu6RXFMVCe30cIFljniI4OjqAU67pQ==}
peerDependencies: peerDependencies:
'@types/react': '>= 16.8.0 < 19.0.0' '@types/react': '>= 16.8.0 < 19.0.0'
react: '>= 16.8.0 < 19.0.0' react: '>= 16.8.0 < 19.0.0'
@ -321,9 +335,12 @@ packages:
react-dom: react-dom:
optional: true optional: true
dependencies: dependencies:
'@algolia/autocomplete-core': 1.6.3 '@algolia/autocomplete-core': 1.7.1
'@docsearch/css': 3.1.0 '@algolia/autocomplete-preset-algolia': 1.7.1_algoliasearch@4.11.0
'@docsearch/css': 3.1.1
algoliasearch: 4.11.0 algoliasearch: 4.11.0
transitivePeerDependencies:
- '@algolia/client-search'
dev: false dev: false
/@hutson/parse-repository-url/3.0.2: /@hutson/parse-repository-url/3.0.2:
@ -679,6 +696,36 @@ packages:
vue: 3.2.37 vue: 3.2.37
dev: false dev: false
/@volar/code-gen/0.38.2:
resolution: {integrity: sha512-H81I6d7rZB7teqL+zhK/Xz1v0/kKkUwkB0Aq6b4+BTCqcJeiZkoWxd0gFhrhWTnUoqiM83lhoTGo2vkvx5YagQ==}
dependencies:
'@volar/source-map': 0.38.2
dev: true
/@volar/source-map/0.38.2:
resolution: {integrity: sha512-DWcYbYt9SPwk0r4VmXk1F0v4X5+hCqH1JRkAWSeJymQyXCQ2OQDEbY2PF12a7y2qn4FUBD2gOba2TynAqI8ZFQ==}
dev: true
/@volar/vue-code-gen/0.38.2:
resolution: {integrity: sha512-whLunD6phSGWBUHZKdTxeglrpzQu26ii8CRVapFdjfyMaVhQ7ESNeIAhkTVyg2ovOPc0PiDYPQEPzfWAADIWog==}
dependencies:
'@volar/code-gen': 0.38.2
'@volar/source-map': 0.38.2
'@vue/compiler-core': 3.2.37
'@vue/compiler-dom': 3.2.37
'@vue/shared': 3.2.37
dev: true
/@volar/vue-typescript/0.38.2:
resolution: {integrity: sha512-5IKvSK2m5yUmH6iu/tNScVlvJGuiHawTfSmjxaMs+/tod25WeK37LEdf+pdKtlJ30bYTQmmkAuEfG01QvvBRGQ==}
dependencies:
'@volar/code-gen': 0.38.2
'@volar/source-map': 0.38.2
'@volar/vue-code-gen': 0.38.2
'@vue/compiler-sfc': 3.2.37
'@vue/reactivity': 3.2.37
dev: true
/@vue/compiler-core/3.2.37: /@vue/compiler-core/3.2.37:
resolution: {integrity: sha512-81KhEjo7YAOh0vQJoSmAD68wLfYqJvoiD4ulyedzF+OEk/bk6/hx3fTNVfuzugIIaTrOx4PGx6pAiBRe5e9Zmg==} resolution: {integrity: sha512-81KhEjo7YAOh0vQJoSmAD68wLfYqJvoiD4ulyedzF+OEk/bk6/hx3fTNVfuzugIIaTrOx4PGx6pAiBRe5e9Zmg==}
dependencies: dependencies:
@ -686,14 +733,12 @@ packages:
'@vue/shared': 3.2.37 '@vue/shared': 3.2.37
estree-walker: 2.0.2 estree-walker: 2.0.2
source-map: 0.6.1 source-map: 0.6.1
dev: false
/@vue/compiler-dom/3.2.37: /@vue/compiler-dom/3.2.37:
resolution: {integrity: sha512-yxJLH167fucHKxaqXpYk7x8z7mMEnXOw3G2q62FTkmsvNxu4FQSu5+3UMb+L7fjKa26DEzhrmCxAgFLLIzVfqQ==} resolution: {integrity: sha512-yxJLH167fucHKxaqXpYk7x8z7mMEnXOw3G2q62FTkmsvNxu4FQSu5+3UMb+L7fjKa26DEzhrmCxAgFLLIzVfqQ==}
dependencies: dependencies:
'@vue/compiler-core': 3.2.37 '@vue/compiler-core': 3.2.37
'@vue/shared': 3.2.37 '@vue/shared': 3.2.37
dev: false
/@vue/compiler-sfc/3.2.37: /@vue/compiler-sfc/3.2.37:
resolution: {integrity: sha512-+7i/2+9LYlpqDv+KTtWhOZH+pa8/HnX/905MdVmAcI/mPQOBwkHHIzrsEsucyOIZQYMkXUiTkmZq5am/NyXKkg==} resolution: {integrity: sha512-+7i/2+9LYlpqDv+KTtWhOZH+pa8/HnX/905MdVmAcI/mPQOBwkHHIzrsEsucyOIZQYMkXUiTkmZq5am/NyXKkg==}
@ -708,17 +753,15 @@ packages:
magic-string: 0.25.7 magic-string: 0.25.7
postcss: 8.4.14 postcss: 8.4.14
source-map: 0.6.1 source-map: 0.6.1
dev: false
/@vue/compiler-ssr/3.2.37: /@vue/compiler-ssr/3.2.37:
resolution: {integrity: sha512-7mQJD7HdXxQjktmsWp/J67lThEIcxLemz1Vb5I6rYJHR5vI+lON3nPGOH3ubmbvYGt8xEUaAr1j7/tIFWiEOqw==} resolution: {integrity: sha512-7mQJD7HdXxQjktmsWp/J67lThEIcxLemz1Vb5I6rYJHR5vI+lON3nPGOH3ubmbvYGt8xEUaAr1j7/tIFWiEOqw==}
dependencies: dependencies:
'@vue/compiler-dom': 3.2.37 '@vue/compiler-dom': 3.2.37
'@vue/shared': 3.2.37 '@vue/shared': 3.2.37
dev: false
/@vue/devtools-api/6.1.4: /@vue/devtools-api/6.2.0:
resolution: {integrity: sha512-IiA0SvDrJEgXvVxjNkHPFfDx6SXw0b/TUkqMcDZWNg9fnCAHbTpoo59YfJ9QLFkwa3raau5vSlRVzMSLDnfdtQ==} resolution: {integrity: sha512-pF1G4wky+hkifDiZSWn8xfuLOJI1ZXtuambpBEYaf7Xaf6zC/pM29rvAGpd3qaGXnr4BAXU1Pxz/VfvBGwexGA==}
dev: false dev: false
/@vue/reactivity-transform/3.2.37: /@vue/reactivity-transform/3.2.37:
@ -729,13 +772,11 @@ packages:
'@vue/shared': 3.2.37 '@vue/shared': 3.2.37
estree-walker: 2.0.2 estree-walker: 2.0.2
magic-string: 0.25.7 magic-string: 0.25.7
dev: false
/@vue/reactivity/3.2.37: /@vue/reactivity/3.2.37:
resolution: {integrity: sha512-/7WRafBOshOc6m3F7plwzPeCu/RCVv9uMpOwa/5PiY1Zz+WLVRWiy0MYKwmg19KBdGtFWsmZ4cD+LOdVPcs52A==} resolution: {integrity: sha512-/7WRafBOshOc6m3F7plwzPeCu/RCVv9uMpOwa/5PiY1Zz+WLVRWiy0MYKwmg19KBdGtFWsmZ4cD+LOdVPcs52A==}
dependencies: dependencies:
'@vue/shared': 3.2.37 '@vue/shared': 3.2.37
dev: false
/@vue/runtime-core/3.2.37: /@vue/runtime-core/3.2.37:
resolution: {integrity: sha512-JPcd9kFyEdXLl/i0ClS7lwgcs0QpUAWj+SKX2ZC3ANKi1U4DOtiEr6cRqFXsPwY5u1L9fAjkinIdB8Rz3FoYNQ==} resolution: {integrity: sha512-JPcd9kFyEdXLl/i0ClS7lwgcs0QpUAWj+SKX2ZC3ANKi1U4DOtiEr6cRqFXsPwY5u1L9fAjkinIdB8Rz3FoYNQ==}
@ -764,7 +805,6 @@ packages:
/@vue/shared/3.2.37: /@vue/shared/3.2.37:
resolution: {integrity: sha512-4rSJemR2NQIo9Klm1vabqWjD8rs/ZaJSzMxkMNeJS6lHiUjjUeYFbooN19NgFjztubEKh3WlZUeOLVdbbUWHsw==} resolution: {integrity: sha512-4rSJemR2NQIo9Klm1vabqWjD8rs/ZaJSzMxkMNeJS6lHiUjjUeYFbooN19NgFjztubEKh3WlZUeOLVdbbUWHsw==}
dev: false
/@vueuse/core/8.7.5_vue@3.2.37: /@vueuse/core/8.7.5_vue@3.2.37:
resolution: {integrity: sha512-tqgzeZGoZcXzoit4kOGLWJibDMLp0vdm6ZO41SSUQhkhtrPhAg6dbIEPiahhUu6sZAmSYvVrZgEr5aKD51nrLA==} resolution: {integrity: sha512-tqgzeZGoZcXzoit4kOGLWJibDMLp0vdm6ZO41SSUQhkhtrPhAg6dbIEPiahhUu6sZAmSYvVrZgEr5aKD51nrLA==}
@ -3379,7 +3419,6 @@ packages:
/to-fast-properties/2.0.0: /to-fast-properties/2.0.0:
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}
engines: {node: '>=4'} engines: {node: '>=4'}
dev: false
/to-regex-range/5.0.1: /to-regex-range/5.0.1:
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
@ -3597,6 +3636,16 @@ packages:
vue: 3.2.37 vue: 3.2.37
dev: false dev: false
/vue-tsc/0.38.2_typescript@4.7.4:
resolution: {integrity: sha512-+OMmpw9BZC9khul3I1HGtWchv7BCiaM7NvfdilVAiOFkjnivIoaW6jJm6YPQJaEPouePtpkDUWovyzgNxWdDsw==}
hasBin: true
peerDependencies:
typescript: '*'
dependencies:
'@volar/vue-typescript': 0.38.2
typescript: 4.7.4
dev: true
/vue/3.2.37: /vue/3.2.37:
resolution: {integrity: sha512-bOKEZxrm8Eh+fveCqS1/NkG/n6aMidsI6hahas7pa0w/l7jkbssJVsRhVDs07IdDq7h9KHswZOgItnwJAgtVtQ==} resolution: {integrity: sha512-bOKEZxrm8Eh+fveCqS1/NkG/n6aMidsI6hahas7pa0w/l7jkbssJVsRhVDs07IdDq7h9KHswZOgItnwJAgtVtQ==}
dependencies: dependencies:

@ -14,9 +14,3 @@ declare module '@siteData' {
const data: SiteData const data: SiteData
export default data export default data
} }
// this module's typing is broken.
declare module '@docsearch/js' {
function docsearch<T = any>(props: T): void
export default docsearch
}

@ -29,14 +29,20 @@ function poll() {
}, 16) }, 16)
} }
type DocSearchProps = Parameters<typeof docsearch>[0]
function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) { function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
// note: multi-lang search support is removed since the theme // note: multi-lang search support is removed since the theme
// doesn't support multiple locales as of now. // doesn't support multiple locales as of now.
const options = Object.assign({}, userOptions, { const options = Object.assign<
{},
DefaultTheme.AlgoliaSearchOptions,
DocSearchProps
>({}, userOptions, {
container: '#docsearch', container: '#docsearch',
navigator: { navigator: {
navigate({ itemUrl }: { itemUrl: string }) { navigate({ itemUrl }) {
const { pathname: hitPathname } = new URL( const { pathname: hitPathname } = new URL(
window.location.origin + itemUrl window.location.origin + itemUrl
) )
@ -51,7 +57,7 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
} }
}, },
transformItems(items: any[]) { transformItems(items) {
return items.map((item) => { return items.map((item) => {
return Object.assign({}, item, { return Object.assign({}, item, {
url: getRelativePath(item.url) url: getRelativePath(item.url)
@ -59,7 +65,8 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
}) })
}, },
hitComponent({ hit, children }: { hit: any; children: any }) { // @ts-ignore
hitComponent({ hit, children }) {
const relativeHit = hit.url.startsWith('http') const relativeHit = hit.url.startsWith('http')
? getRelativePath(hit.url as string) ? getRelativePath(hit.url as string)
: hit.url : hit.url

Loading…
Cancel
Save