@docusaurus/theme-search-algolia 3.10.2 → 4.0.0-canary-6809

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.
@@ -8,4 +8,5 @@ export { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
8
8
  export { useAlgoliaContextualFacetFilters, useAlgoliaContextualFacetFiltersIfEnabled, } from './useAlgoliaContextualFacetFilters';
9
9
  export { useSearchResultUrlProcessor } from './useSearchResultUrlProcessor';
10
10
  export { useAlgoliaAskAi } from './useAlgoliaAskAi';
11
+ export { useSearchQueryString, useSearchLinkCreator } from './searchPage';
11
12
  export { mergeFacetFilters } from './utils';
@@ -8,4 +8,5 @@ export { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
8
8
  export { useAlgoliaContextualFacetFilters, useAlgoliaContextualFacetFiltersIfEnabled, } from './useAlgoliaContextualFacetFilters';
9
9
  export { useSearchResultUrlProcessor } from './useSearchResultUrlProcessor';
10
10
  export { useAlgoliaAskAi } from './useAlgoliaAskAi';
11
+ export { useSearchQueryString, useSearchLinkCreator } from './searchPage';
11
12
  export { mergeFacetFilters } from './utils';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Permits to read/write the current search query string
9
+ */
10
+ export declare function useSearchQueryString(): [string, (newValue: string) => void];
11
+ /**
12
+ * Permits to create links to the search page with the appropriate query string
13
+ */
14
+ export declare function useSearchLinkCreator(): (searchValue: string) => string;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { useCallback } from 'react';
8
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
9
+ import { useQueryString } from '@docusaurus/theme-common';
10
+ import { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
11
+ const SEARCH_PARAM_QUERY = 'q';
12
+ /**
13
+ * Permits to read/write the current search query string
14
+ */
15
+ export function useSearchQueryString() {
16
+ return useQueryString(SEARCH_PARAM_QUERY);
17
+ }
18
+ /**
19
+ * Permits to create links to the search page with the appropriate query string
20
+ */
21
+ export function useSearchLinkCreator() {
22
+ const { siteConfig: { baseUrl }, } = useDocusaurusContext();
23
+ const { algolia: { searchPagePath }, } = useAlgoliaThemeConfig();
24
+ return useCallback(function createSearchLink(searchValue) {
25
+ // Refer to https://github.com/facebook/docusaurus/pull/2838
26
+ // Note: if searchPagePath is falsy, useSearchPage() will not be called
27
+ return `${baseUrl}${searchPagePath}?${SEARCH_PARAM_QUERY}=${encodeURIComponent(searchValue)}`;
28
+ }, [baseUrl, searchPagePath]);
29
+ }
package/lib/opensearch.js CHANGED
@@ -16,10 +16,11 @@ const lodash_1 = tslib_1.__importDefault(require("lodash"));
16
16
  const eta_1 = require("eta");
17
17
  const utils_1 = require("@docusaurus/utils");
18
18
  const opensearch_1 = tslib_1.__importDefault(require("./templates/opensearch"));
19
- const getCompiledOpenSearchTemplate = lodash_1.default.memoize(() => (0, eta_1.compile)(opensearch_1.default.trim()));
19
+ const eta = new eta_1.Eta();
20
+ const getCompiledOpenSearchTemplate = lodash_1.default.memoize(() => eta.compile(opensearch_1.default.trim()));
20
21
  function renderOpenSearchTemplate(data) {
21
22
  const compiled = getCompiledOpenSearchTemplate();
22
- return compiled(data, eta_1.defaultConfig);
23
+ return eta.render(compiled, data);
23
24
  }
24
25
  const OPEN_SEARCH_FILENAME = 'opensearch.xml';
25
26
  function shouldCreateOpenSearchFile({ context, }) {
@@ -4,5 +4,5 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- declare const _default: "\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\"\n xmlns:moz=\"http://www.mozilla.org/2006/browser/search/\">\n <ShortName><%= it.title %></ShortName>\n <Description>Search <%= it.title %></Description>\n <InputEncoding>UTF-8</InputEncoding>\n <% if (it.faviconUrl) { _%>\n <Image width=\"16\" height=\"16\" type=\"image/x-icon\"><%= it.faviconUrl %></Image>\n <% } _%>\n <Url type=\"text/html\" method=\"get\" template=\"<%= it.searchUrl %>?q={searchTerms}\"/>\n <Url type=\"application/opensearchdescription+xml\" rel=\"self\" template=\"<%= it.siteUrl %>opensearch.xml\" />\n <moz:SearchForm><%= it.siteUrl %></moz:SearchForm>\n</OpenSearchDescription>\n";
7
+ declare const _default = "\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\"\n xmlns:moz=\"http://www.mozilla.org/2006/browser/search/\">\n <ShortName><%= it.title %></ShortName>\n <Description>Search <%= it.title %></Description>\n <InputEncoding>UTF-8</InputEncoding>\n <% if (it.faviconUrl) { _%>\n <Image width=\"16\" height=\"16\" type=\"image/x-icon\"><%= it.faviconUrl %></Image>\n <% } _%>\n <Url type=\"text/html\" method=\"get\" template=\"<%= it.searchUrl %>?q={searchTerms}\"/>\n <Url type=\"application/opensearchdescription+xml\" rel=\"self\" template=\"<%= it.siteUrl %>opensearch.xml\" />\n <moz:SearchForm><%= it.siteUrl %></moz:SearchForm>\n</OpenSearchDescription>\n";
8
8
  export default _default;
@@ -11,15 +11,13 @@ import {useDocSearchKeyboardEvents} from '@docsearch/react/useDocSearchKeyboardE
11
11
  import Head from '@docusaurus/Head';
12
12
  import Link from '@docusaurus/Link';
13
13
  import {useHistory} from '@docusaurus/router';
14
- import {
15
- isRegexpStringMatch,
16
- useSearchLinkCreator,
17
- } from '@docusaurus/theme-common';
14
+ import {isRegexpStringMatch} from '@docusaurus/theme-common';
18
15
  import {
19
16
  useAlgoliaContextualFacetFilters,
20
17
  useSearchResultUrlProcessor,
21
18
  useAlgoliaAskAi,
22
19
  mergeFacetFilters,
20
+ useSearchLinkCreator,
23
21
  } from '@docusaurus/theme-search-algolia/client';
24
22
  import Translate from '@docusaurus/Translate';
25
23
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
@@ -84,8 +82,8 @@ function useTransformItems(props) {
84
82
  function useResultsFooterComponent({closeModal}) {
85
83
  return useMemo(
86
84
  () =>
87
- ({state}) =>
88
- <ResultsFooter state={state} onClose={closeModal} />,
85
+ // eslint-disable-next-line react/display-name
86
+ ({state}) => <ResultsFooter state={state} onClose={closeModal} />,
89
87
  [closeModal],
90
88
  );
91
89
  }
@@ -193,6 +191,8 @@ function DocSearch({externalUrlRegex, ...props}) {
193
191
 
194
192
  {isOpen &&
195
193
  DocSearchModal &&
194
+ // TODO fix this
195
+ // eslint-disable-next-line react-hooks/refs
196
196
  searchContainer.current &&
197
197
  createPortal(
198
198
  <DocSearchModal
@@ -212,6 +212,8 @@ function DocSearch({externalUrlRegex, ...props}) {
212
212
  searchParameters={searchParameters}
213
213
  {...extraAskAiProps}
214
214
  />,
215
+ // TODO fix this
216
+ // eslint-disable-next-line react-hooks/refs
215
217
  searchContainer.current,
216
218
  )}
217
219
  </>
@@ -18,13 +18,13 @@ import {
18
18
  PageMetadata,
19
19
  useEvent,
20
20
  usePluralForm,
21
- useSearchQueryString,
22
21
  } from '@docusaurus/theme-common';
23
22
  import Translate, {translate} from '@docusaurus/Translate';
24
23
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
25
24
  import {
26
25
  useAlgoliaThemeConfig,
27
26
  useSearchResultUrlProcessor,
27
+ useSearchQueryString,
28
28
  } from '@docusaurus/theme-search-algolia/client';
29
29
  import Layout from '@theme/Layout';
30
30
  import Heading from '@theme/Heading';
@@ -309,7 +309,7 @@ function SearchPageContent() {
309
309
  ExecutionEnvironment.canUseIntersectionObserver &&
310
310
  new IntersectionObserver(
311
311
  // TODO need to fix this React Compiler lint error
312
- // eslint-disable-next-line react-compiler/react-compiler
312
+ // eslint-disable-next-line react-hooks/refs
313
313
  (entries) => {
314
314
  const {
315
315
  isIntersecting,
@@ -461,7 +461,6 @@ function SearchPageContent() {
461
461
  key={index}
462
462
  className="breadcrumbs__item"
463
463
  // Developer provided the HTML, so assume it's safe.
464
- // eslint-disable-next-line react/no-danger
465
464
  dangerouslySetInnerHTML={{__html: html}}
466
465
  />
467
466
  ))}
@@ -473,7 +472,6 @@ function SearchPageContent() {
473
472
  <p
474
473
  className={styles.searchResultItemSummary}
475
474
  // Developer provided the HTML, so assume it's safe.
476
- // eslint-disable-next-line react/no-danger
477
475
  dangerouslySetInnerHTML={{__html: summary}}
478
476
  />
479
477
  )}
@@ -70,7 +70,7 @@
70
70
  font-style: italic;
71
71
  }
72
72
 
73
- @media only screen and (max-width: 996px) {
73
+ @media only screen and (width <= 996px) {
74
74
  .searchQueryColumn {
75
75
  max-width: 60% !important;
76
76
  }
@@ -89,7 +89,7 @@
89
89
  }
90
90
  }
91
91
 
92
- @media screen and (max-width: 576px) {
92
+ @media screen and (width <= 576px) {
93
93
  .searchQueryColumn {
94
94
  max-width: 100% !important;
95
95
  }
@@ -8,7 +8,6 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Schema = exports.DEFAULT_CONFIG = void 0;
10
10
  exports.validateThemeConfig = validateThemeConfig;
11
- const utils_1 = require("@docusaurus/utils");
12
11
  const utils_validation_1 = require("@docusaurus/utils-validation");
13
12
  const docSearchVersion_1 = require("./docSearchVersion");
14
13
  exports.DEFAULT_CONFIG = {
@@ -42,7 +41,7 @@ exports.Schema = utils_validation_1.Joi.object({
42
41
  replaceSearchResultPathname: utils_validation_1.Joi.object({
43
42
  from: utils_validation_1.Joi.custom((from) => {
44
43
  if (typeof from === 'string') {
45
- return (0, utils_1.escapeRegexp)(from);
44
+ return RegExp.escape(from);
46
45
  }
47
46
  else if (from instanceof RegExp) {
48
47
  return from.source;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-search-algolia",
3
- "version": "3.10.2",
3
+ "version": "4.0.0-canary-6809",
4
4
  "description": "Algolia search component for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": [
@@ -27,39 +27,41 @@
27
27
  },
28
28
  "license": "MIT",
29
29
  "scripts": {
30
- "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"",
30
+ "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && oxfmt \"lib/theme/**/*.js\"",
31
31
  "watch": "run-p -c copy:watch build:watch",
32
32
  "build:watch": "tsc --build --watch",
33
33
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
34
34
  },
35
35
  "dependencies": {
36
- "@algolia/autocomplete-core": "^1.19.2",
37
- "@docsearch/react": "^3.9.0 || ^4.3.2",
38
- "@docusaurus/core": "3.10.2",
39
- "@docusaurus/logger": "3.10.2",
40
- "@docusaurus/plugin-content-docs": "3.10.2",
41
- "@docusaurus/theme-common": "3.10.2",
42
- "@docusaurus/theme-translations": "3.10.2",
43
- "@docusaurus/utils": "3.10.2",
44
- "@docusaurus/utils-validation": "3.10.2",
45
- "algoliasearch": "^5.37.0",
46
- "algoliasearch-helper": "^3.26.0",
47
- "clsx": "^2.0.0",
48
- "eta": "^2.2.0",
49
- "fs-extra": "^11.1.1",
50
- "lodash": "^4.17.21",
51
- "tslib": "^2.6.0",
52
- "utility-types": "^3.10.0"
36
+ "@algolia/autocomplete-core": "^1.19.10",
37
+ "@docsearch/react": "^4.7.0",
38
+ "@docusaurus/core": "4.0.0-canary-6809",
39
+ "@docusaurus/logger": "4.0.0-canary-6809",
40
+ "@docusaurus/plugin-content-docs": "4.0.0-canary-6809",
41
+ "@docusaurus/theme-classic": "4.0.0-canary-6809",
42
+ "@docusaurus/theme-common": "4.0.0-canary-6809",
43
+ "@docusaurus/theme-translations": "4.0.0-canary-6809",
44
+ "@docusaurus/utils": "4.0.0-canary-6809",
45
+ "@docusaurus/utils-validation": "4.0.0-canary-6809",
46
+ "algoliasearch": "^5.57.0",
47
+ "algoliasearch-helper": "^3.29.3",
48
+ "clsx": "^2.1.1",
49
+ "eta": "^4.6.0",
50
+ "fs-extra": "^11.4.0",
51
+ "lodash": "^4.18.1",
52
+ "tslib": "^2.8.1",
53
+ "utility-types": "^3.11.0"
53
54
  },
54
55
  "devDependencies": {
55
- "@docusaurus/module-type-aliases": "3.10.2"
56
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6809",
57
+ "@docusaurus/types": "4.0.0-canary-6809"
56
58
  },
57
59
  "peerDependencies": {
58
- "react": "^18.0.0 || ^19.0.0",
59
- "react-dom": "^18.0.0 || ^19.0.0"
60
+ "react": "^19.3.0",
61
+ "react-dom": "^19.3.0"
60
62
  },
61
63
  "engines": {
62
- "node": ">=20.0"
64
+ "node": ">=24.14"
63
65
  },
64
- "gitHead": "f37f9035584917a97a260b91fc2842cba4f8b94f"
66
+ "gitHead": "db942b07f3529b5359bcae27ab3796cb07dec10e"
65
67
  }
@@ -12,4 +12,5 @@ export {
12
12
  } from './useAlgoliaContextualFacetFilters';
13
13
  export {useSearchResultUrlProcessor} from './useSearchResultUrlProcessor';
14
14
  export {useAlgoliaAskAi} from './useAlgoliaAskAi';
15
+ export {useSearchQueryString, useSearchLinkCreator} from './searchPage';
15
16
  export {mergeFacetFilters} from './utils';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {useCallback} from 'react';
9
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
10
+ import {useQueryString} from '@docusaurus/theme-common';
11
+ import {useAlgoliaThemeConfig} from './useAlgoliaThemeConfig';
12
+
13
+ const SEARCH_PARAM_QUERY = 'q';
14
+
15
+ /**
16
+ * Permits to read/write the current search query string
17
+ */
18
+ export function useSearchQueryString(): [string, (newValue: string) => void] {
19
+ return useQueryString(SEARCH_PARAM_QUERY);
20
+ }
21
+
22
+ /**
23
+ * Permits to create links to the search page with the appropriate query string
24
+ */
25
+ export function useSearchLinkCreator(): (searchValue: string) => string {
26
+ const {
27
+ siteConfig: {baseUrl},
28
+ } = useDocusaurusContext();
29
+ const {
30
+ algolia: {searchPagePath},
31
+ } = useAlgoliaThemeConfig();
32
+
33
+ return useCallback(
34
+ function createSearchLink(searchValue: string) {
35
+ // Refer to https://github.com/facebook/docusaurus/pull/2838
36
+ // Note: if searchPagePath is falsy, useSearchPage() will not be called
37
+ return `${baseUrl}${
38
+ searchPagePath as string
39
+ }?${SEARCH_PARAM_QUERY}=${encodeURIComponent(searchValue)}`;
40
+ },
41
+ [baseUrl, searchPagePath],
42
+ );
43
+ }
package/src/deps.d.ts CHANGED
@@ -8,13 +8,3 @@
8
8
  declare module '@docsearch/react/modal';
9
9
 
10
10
  declare module '@docsearch/react/style';
11
-
12
- // TODO incompatible declaration file
13
- declare module 'eta' {
14
- export const defaultConfig: object;
15
-
16
- export function compile(
17
- template: string,
18
- options?: object,
19
- ): (data: object, config: object) => string;
20
- }
package/src/opensearch.ts CHANGED
@@ -8,15 +8,17 @@
8
8
  import path from 'path';
9
9
  import fs from 'fs-extra';
10
10
  import _ from 'lodash';
11
- import {defaultConfig, compile} from 'eta';
11
+ import {Eta} from 'eta';
12
12
  import {normalizeUrl} from '@docusaurus/utils';
13
13
  import openSearchTemplate from './templates/opensearch';
14
14
 
15
15
  import type {HtmlTags, LoadContext} from '@docusaurus/types';
16
16
  import type {ThemeConfig} from '@docusaurus/theme-search-algolia';
17
17
 
18
+ const eta = new Eta();
19
+
18
20
  const getCompiledOpenSearchTemplate = _.memoize(() =>
19
- compile(openSearchTemplate.trim()),
21
+ eta.compile(openSearchTemplate.trim()),
20
22
  );
21
23
 
22
24
  function renderOpenSearchTemplate(data: {
@@ -26,7 +28,7 @@ function renderOpenSearchTemplate(data: {
26
28
  faviconUrl: string | null;
27
29
  }) {
28
30
  const compiled = getCompiledOpenSearchTemplate();
29
- return compiled(data, defaultConfig);
31
+ return eta.render(compiled, data);
30
32
  }
31
33
 
32
34
  const OPEN_SEARCH_FILENAME = 'opensearch.xml';
@@ -18,15 +18,13 @@ import {useDocSearchKeyboardEvents} from '@docsearch/react/useDocSearchKeyboardE
18
18
  import Head from '@docusaurus/Head';
19
19
  import Link from '@docusaurus/Link';
20
20
  import {useHistory} from '@docusaurus/router';
21
- import {
22
- isRegexpStringMatch,
23
- useSearchLinkCreator,
24
- } from '@docusaurus/theme-common';
21
+ import {isRegexpStringMatch} from '@docusaurus/theme-common';
25
22
  import {
26
23
  useAlgoliaContextualFacetFilters,
27
24
  useSearchResultUrlProcessor,
28
25
  useAlgoliaAskAi,
29
26
  mergeFacetFilters,
27
+ useSearchLinkCreator,
30
28
  } from '@docusaurus/theme-search-algolia/client';
31
29
  import Translate from '@docusaurus/Translate';
32
30
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
@@ -140,8 +138,8 @@ function useResultsFooterComponent({
140
138
  }): DocSearchProps['resultsFooterComponent'] {
141
139
  return useMemo(
142
140
  () =>
143
- ({state}) =>
144
- <ResultsFooter state={state} onClose={closeModal} />,
141
+ // eslint-disable-next-line react/display-name
142
+ ({state}) => <ResultsFooter state={state} onClose={closeModal} />,
145
143
  [closeModal],
146
144
  );
147
145
  }
@@ -287,6 +285,8 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchV4Props) {
287
285
 
288
286
  {isOpen &&
289
287
  DocSearchModal &&
288
+ // TODO fix this
289
+ // eslint-disable-next-line react-hooks/refs
290
290
  searchContainer.current &&
291
291
  createPortal(
292
292
  <DocSearchModal
@@ -306,6 +306,9 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchV4Props) {
306
306
  searchParameters={searchParameters}
307
307
  {...extraAskAiProps}
308
308
  />,
309
+
310
+ // TODO fix this
311
+ // eslint-disable-next-line react-hooks/refs
309
312
  searchContainer.current,
310
313
  )}
311
314
  </>
@@ -28,13 +28,13 @@ import {
28
28
  PageMetadata,
29
29
  useEvent,
30
30
  usePluralForm,
31
- useSearchQueryString,
32
31
  } from '@docusaurus/theme-common';
33
32
  import Translate, {translate} from '@docusaurus/Translate';
34
33
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
35
34
  import {
36
35
  useAlgoliaThemeConfig,
37
36
  useSearchResultUrlProcessor,
37
+ useSearchQueryString,
38
38
  } from '@docusaurus/theme-search-algolia/client';
39
39
  import Layout from '@theme/Layout';
40
40
  import Heading from '@theme/Heading';
@@ -372,7 +372,7 @@ function SearchPageContent(): ReactNode {
372
372
  ExecutionEnvironment.canUseIntersectionObserver &&
373
373
  new IntersectionObserver(
374
374
  // TODO need to fix this React Compiler lint error
375
- // eslint-disable-next-line react-compiler/react-compiler
375
+ // eslint-disable-next-line react-hooks/refs
376
376
  (entries) => {
377
377
  const {
378
378
  isIntersecting,
@@ -536,7 +536,6 @@ function SearchPageContent(): ReactNode {
536
536
  key={index}
537
537
  className="breadcrumbs__item"
538
538
  // Developer provided the HTML, so assume it's safe.
539
- // eslint-disable-next-line react/no-danger
540
539
  dangerouslySetInnerHTML={{__html: html}}
541
540
  />
542
541
  ))}
@@ -548,7 +547,6 @@ function SearchPageContent(): ReactNode {
548
547
  <p
549
548
  className={styles.searchResultItemSummary}
550
549
  // Developer provided the HTML, so assume it's safe.
551
- // eslint-disable-next-line react/no-danger
552
550
  dangerouslySetInnerHTML={{__html: summary}}
553
551
  />
554
552
  )}
@@ -70,7 +70,7 @@
70
70
  font-style: italic;
71
71
  }
72
72
 
73
- @media only screen and (max-width: 996px) {
73
+ @media only screen and (width <= 996px) {
74
74
  .searchQueryColumn {
75
75
  max-width: 60% !important;
76
76
  }
@@ -89,7 +89,7 @@
89
89
  }
90
90
  }
91
91
 
92
- @media screen and (max-width: 576px) {
92
+ @media screen and (width <= 576px) {
93
93
  .searchQueryColumn {
94
94
  max-width: 100% !important;
95
95
  }
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import {escapeRegexp} from '@docusaurus/utils';
9
8
  import {Joi} from '@docusaurus/utils-validation';
10
9
  import {docSearchV3} from './docSearchVersion';
11
10
  import type {ThemeConfigValidationContext} from '@docusaurus/types';
@@ -50,7 +49,7 @@ export const Schema = Joi.object<ThemeConfig>({
50
49
  replaceSearchResultPathname: Joi.object({
51
50
  from: Joi.custom((from) => {
52
51
  if (typeof from === 'string') {
53
- return escapeRegexp(from);
52
+ return RegExp.escape(from);
54
53
  } else if (from instanceof RegExp) {
55
54
  return from.source;
56
55
  }