@docusaurus/theme-search-algolia 0.0.0-5042 → 0.0.0-5047

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -39,7 +39,7 @@ function themeSearchAlgolia(context) {
39
39
  name: 'theme-search-algolia',
40
40
  });
41
41
  },
42
- async contentLoaded({ actions: { addRoute } }) {
42
+ contentLoaded({ actions: { addRoute } }) {
43
43
  if (searchPagePath) {
44
44
  addRoute({
45
45
  path: (0, utils_1.normalizeUrl)([baseUrl, searchPagePath]),
@@ -11,5 +11,5 @@ export declare const DEFAULT_CONFIG: {
11
11
  searchParameters: {};
12
12
  searchPagePath: string;
13
13
  };
14
- export declare const Schema: Joi.ObjectSchema<any>;
14
+ export declare const Schema: Joi.ObjectSchema<ThemeConfig>;
15
15
  export declare function validateThemeConfig({ validate, themeConfig, }: ThemeConfigValidationContext<ThemeConfig>): ThemeConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-search-algolia",
3
- "version": "0.0.0-5042",
3
+ "version": "0.0.0-5047",
4
4
  "description": "Algolia search component for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": [
@@ -28,13 +28,13 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@docsearch/react": "^3.1.0",
31
- "@docusaurus/core": "0.0.0-5042",
32
- "@docusaurus/logger": "0.0.0-5042",
33
- "@docusaurus/plugin-content-docs": "0.0.0-5042",
34
- "@docusaurus/theme-common": "0.0.0-5042",
35
- "@docusaurus/theme-translations": "0.0.0-5042",
36
- "@docusaurus/utils": "0.0.0-5042",
37
- "@docusaurus/utils-validation": "0.0.0-5042",
31
+ "@docusaurus/core": "0.0.0-5047",
32
+ "@docusaurus/logger": "0.0.0-5047",
33
+ "@docusaurus/plugin-content-docs": "0.0.0-5047",
34
+ "@docusaurus/theme-common": "0.0.0-5047",
35
+ "@docusaurus/theme-translations": "0.0.0-5047",
36
+ "@docusaurus/utils": "0.0.0-5047",
37
+ "@docusaurus/utils-validation": "0.0.0-5047",
38
38
  "algoliasearch": "^4.13.1",
39
39
  "algoliasearch-helper": "^3.8.2",
40
40
  "clsx": "^1.1.1",
@@ -45,7 +45,7 @@
45
45
  "utility-types": "^3.10.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@docusaurus/module-type-aliases": "0.0.0-5042"
48
+ "@docusaurus/module-type-aliases": "0.0.0-5047"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^16.8.4 || ^17.0.0",
@@ -54,5 +54,5 @@
54
54
  "engines": {
55
55
  "node": ">=14"
56
56
  },
57
- "gitHead": "af5fa0b311db8cf3934d437d74435966eb456c38"
57
+ "gitHead": "67ac297469d98ac3eb8482d8636aee4648586f33"
58
58
  }
package/src/index.ts CHANGED
@@ -60,7 +60,7 @@ export default function themeSearchAlgolia(context: LoadContext): Plugin<void> {
60
60
  });
61
61
  },
62
62
 
63
- async contentLoaded({actions: {addRoute}}) {
63
+ contentLoaded({actions: {addRoute}}) {
64
64
  if (searchPagePath) {
65
65
  addRoute({
66
66
  path: normalizeUrl([baseUrl, searchPagePath]),
@@ -237,10 +237,14 @@ function SearchPageContent(): JSX.Element {
237
237
  url,
238
238
  _highlightResult: {hierarchy},
239
239
  _snippetResult: snippet = {},
240
+ }: {
241
+ url: string;
242
+ _highlightResult: {hierarchy: {[key: string]: {value: string}}};
243
+ _snippetResult: {content?: {value: string}};
240
244
  }) => {
241
245
  const parsedURL = new URL(url);
242
246
  const titles = Object.keys(hierarchy).map((key) =>
243
- sanitizeValue(hierarchy[key].value),
247
+ sanitizeValue(hierarchy[key]!.value),
244
248
  );
245
249
 
246
250
  return {
@@ -20,7 +20,7 @@ export const DEFAULT_CONFIG = {
20
20
  searchPagePath: 'search',
21
21
  };
22
22
 
23
- export const Schema = Joi.object({
23
+ export const Schema = Joi.object<ThemeConfig>({
24
24
  algolia: Joi.object({
25
25
  // Docusaurus attributes
26
26
  contextualSearch: Joi.boolean().default(DEFAULT_CONFIG.contextualSearch),