@docusaurus/theme-search-algolia 0.0.0-4383 → 0.0.0-4384
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.d.ts +2 -4
- package/lib/index.js +3 -9
- package/package.json +9 -9
- package/src/index.ts +4 -14
package/lib/index.d.ts
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
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
|
-
import type {
|
|
8
|
-
export default function
|
|
9
|
-
baseUrl: string;
|
|
10
|
-
}): Plugin<void>;
|
|
7
|
+
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
8
|
+
export default function themeSearchAlgolia(context: LoadContext): Plugin<void>;
|
|
11
9
|
export { validateThemeConfig } from './validateThemeConfig';
|
package/lib/index.js
CHANGED
|
@@ -22,16 +22,10 @@ function renderOpenSearchTemplate(data) {
|
|
|
22
22
|
return compiled(data, eta_1.defaultConfig);
|
|
23
23
|
}
|
|
24
24
|
const OPEN_SEARCH_FILENAME = 'opensearch.xml';
|
|
25
|
-
function
|
|
25
|
+
function themeSearchAlgolia(context) {
|
|
26
26
|
const { baseUrl, siteConfig: { title, url, favicon }, i18n: { currentLocale }, } = context;
|
|
27
|
-
const pageComponent = './theme/SearchPage/index.js';
|
|
28
|
-
const pagePath = (0, utils_1.getSwizzledComponent)(pageComponent) ||
|
|
29
|
-
path_1.default.resolve(__dirname, pageComponent);
|
|
30
27
|
return {
|
|
31
28
|
name: 'docusaurus-theme-search-algolia',
|
|
32
|
-
getPathsToWatch() {
|
|
33
|
-
return [pagePath];
|
|
34
|
-
},
|
|
35
29
|
getThemePath() {
|
|
36
30
|
return path_1.default.resolve(__dirname, './theme');
|
|
37
31
|
},
|
|
@@ -47,7 +41,7 @@ function theme(context) {
|
|
|
47
41
|
async contentLoaded({ actions: { addRoute } }) {
|
|
48
42
|
addRoute({
|
|
49
43
|
path: (0, utils_1.normalizeUrl)([baseUrl, 'search']),
|
|
50
|
-
component:
|
|
44
|
+
component: '@theme/SearchPage',
|
|
51
45
|
exact: true,
|
|
52
46
|
});
|
|
53
47
|
},
|
|
@@ -81,6 +75,6 @@ function theme(context) {
|
|
|
81
75
|
},
|
|
82
76
|
};
|
|
83
77
|
}
|
|
84
|
-
exports.default =
|
|
78
|
+
exports.default = themeSearchAlgolia;
|
|
85
79
|
var validateThemeConfig_1 = require("./validateThemeConfig");
|
|
86
80
|
Object.defineProperty(exports, "validateThemeConfig", { enumerable: true, get: function () { return validateThemeConfig_1.validateThemeConfig; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-search-algolia",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4384",
|
|
4
4
|
"description": "Algolia search component for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@docsearch/react": "^3.0.0-alpha.39",
|
|
28
|
-
"@docusaurus/core": "0.0.0-
|
|
29
|
-
"@docusaurus/logger": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
31
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
28
|
+
"@docusaurus/core": "0.0.0-4384",
|
|
29
|
+
"@docusaurus/logger": "0.0.0-4384",
|
|
30
|
+
"@docusaurus/theme-common": "0.0.0-4384",
|
|
31
|
+
"@docusaurus/theme-translations": "0.0.0-4384",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-4384",
|
|
33
|
+
"@docusaurus/utils-validation": "0.0.0-4384",
|
|
34
34
|
"algoliasearch": "^4.10.5",
|
|
35
35
|
"algoliasearch-helper": "^3.5.5",
|
|
36
36
|
"clsx": "^1.1.1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"utility-types": "^3.10.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
43
|
+
"@docusaurus/module-type-aliases": "0.0.0-4384",
|
|
44
44
|
"fs-extra": "^10.0.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=14"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "51cb250b7c01a53bdf32414249281eab0b320df8"
|
|
54
54
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import fs from 'fs';
|
|
10
10
|
import {defaultConfig, compile} from 'eta';
|
|
11
|
-
import {normalizeUrl
|
|
11
|
+
import {normalizeUrl} from '@docusaurus/utils';
|
|
12
12
|
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
|
13
13
|
import logger from '@docusaurus/logger';
|
|
14
14
|
import openSearchTemplate from './templates/opensearch';
|
|
15
15
|
import {memoize} from 'lodash';
|
|
16
16
|
|
|
17
|
-
import type {
|
|
17
|
+
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
18
18
|
|
|
19
19
|
const getCompiledOpenSearchTemplate = memoize(() =>
|
|
20
20
|
compile(openSearchTemplate.trim()),
|
|
@@ -31,26 +31,16 @@ function renderOpenSearchTemplate(data: {
|
|
|
31
31
|
|
|
32
32
|
const OPEN_SEARCH_FILENAME = 'opensearch.xml';
|
|
33
33
|
|
|
34
|
-
export default function
|
|
35
|
-
context: DocusaurusContext & {baseUrl: string},
|
|
36
|
-
): Plugin<void> {
|
|
34
|
+
export default function themeSearchAlgolia(context: LoadContext): Plugin<void> {
|
|
37
35
|
const {
|
|
38
36
|
baseUrl,
|
|
39
37
|
siteConfig: {title, url, favicon},
|
|
40
38
|
i18n: {currentLocale},
|
|
41
39
|
} = context;
|
|
42
|
-
const pageComponent = './theme/SearchPage/index.js';
|
|
43
|
-
const pagePath =
|
|
44
|
-
getSwizzledComponent(pageComponent) ||
|
|
45
|
-
path.resolve(__dirname, pageComponent);
|
|
46
40
|
|
|
47
41
|
return {
|
|
48
42
|
name: 'docusaurus-theme-search-algolia',
|
|
49
43
|
|
|
50
|
-
getPathsToWatch() {
|
|
51
|
-
return [pagePath];
|
|
52
|
-
},
|
|
53
|
-
|
|
54
44
|
getThemePath() {
|
|
55
45
|
return path.resolve(__dirname, './theme');
|
|
56
46
|
},
|
|
@@ -69,7 +59,7 @@ export default function theme(
|
|
|
69
59
|
async contentLoaded({actions: {addRoute}}) {
|
|
70
60
|
addRoute({
|
|
71
61
|
path: normalizeUrl([baseUrl, 'search']),
|
|
72
|
-
component:
|
|
62
|
+
component: '@theme/SearchPage',
|
|
73
63
|
exact: true,
|
|
74
64
|
});
|
|
75
65
|
},
|