@vuepress-plume/plugin-search 1.0.0-rc.164 → 1.0.0-rc.165
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/node/index.d.ts +1 -1
- package/lib/node/index.js +3 -5
- package/lib/shared/index.d.ts +8 -8
- package/package.json +2 -2
package/lib/node/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from "../shared/index.js";
|
|
|
6
6
|
interface SearchIndexOptions {
|
|
7
7
|
app: App;
|
|
8
8
|
searchOptions: SearchOptions;
|
|
9
|
-
isSearchable: SearchPluginOptions[
|
|
9
|
+
isSearchable: SearchPluginOptions['isSearchable'];
|
|
10
10
|
}
|
|
11
11
|
declare function prepareSearchIndex({
|
|
12
12
|
app,
|
package/lib/node/index.js
CHANGED
|
@@ -38,8 +38,7 @@ async function prepareSearchIndex({ app, isSearchable, searchOptions }) {
|
|
|
38
38
|
const start = performance.now();
|
|
39
39
|
indexByLocales.clear();
|
|
40
40
|
indexCache.clear();
|
|
41
|
-
|
|
42
|
-
await pMap(pages, (p) => indexFile(p, searchOptions), { concurrency: 64 });
|
|
41
|
+
await pMap(isSearchable ? app.pages.filter(isSearchable) : app.pages, (p) => indexFile(p, searchOptions), { concurrency: 64 });
|
|
43
42
|
await writeTemp(app);
|
|
44
43
|
if (app.env.isDebug) logger.info(`\n[${colors.green("@vuepress-plume/plugin-search")}] prepare search time spent: ${(performance.now() - start).toFixed(2)}ms`);
|
|
45
44
|
}
|
|
@@ -77,9 +76,8 @@ async function indexFile(page, options) {
|
|
|
77
76
|
const locale = page.pathLocale;
|
|
78
77
|
const index = getIndexByLocale(locale, options);
|
|
79
78
|
const cache = getIndexCache(fileId);
|
|
80
|
-
const
|
|
81
|
-
${page.contentRendered}
|
|
82
|
-
const sections = splitPageIntoSections(html);
|
|
79
|
+
const sections = splitPageIntoSections(`<h1><a href="#"><span>${page.frontmatter.title || page.title}</span></a></h1>
|
|
80
|
+
${page.contentRendered}`);
|
|
83
81
|
if (cache && cache.length) index.removeAll(cache);
|
|
84
82
|
for await (const section of sections) {
|
|
85
83
|
if (!section || !(section.text || section.titles)) break;
|
package/lib/shared/index.d.ts
CHANGED
|
@@ -25,18 +25,18 @@ interface SearchPluginOptions extends SearchOptions {
|
|
|
25
25
|
}
|
|
26
26
|
interface SearchOptions {
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
30
|
disableQueryPersistence?: boolean;
|
|
31
31
|
miniSearch?: {
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
options?: Pick<Options,
|
|
33
|
+
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#options
|
|
34
|
+
*/
|
|
35
|
+
options?: Pick<Options, 'extractField' | 'tokenize' | 'processTerm'>;
|
|
36
36
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
searchOptions?: Options[
|
|
37
|
+
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#searchoptions-1
|
|
38
|
+
*/
|
|
39
|
+
searchOptions?: Options['searchOptions'];
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress-plume/plugin-search",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.165",
|
|
5
5
|
"description": "The Plugin for VuePress 2 - local search",
|
|
6
6
|
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"mark.js": "^8.11.1",
|
|
43
43
|
"minisearch": "^7.2.0",
|
|
44
44
|
"p-map": "^7.0.3",
|
|
45
|
-
"vue": "^3.5.
|
|
45
|
+
"vue": "^3.5.22"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|