Skip to content

Commit 63857e9

Browse files
committed
new version
1 parent a1cb54c commit 63857e9

File tree

7 files changed

+33
-224
lines changed

7 files changed

+33
-224
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# vuepress-search-plugin
1+
#### VuePress v2 Full-text Search Plugin
2+
3+
##### Overview
4+
5+
This plugin provides full-text search functionality for **VuePress v2**. It is designed to address the search needs of VuePress sites, offering a fast and efficient way to search through the content of your site. The plugin automatically generates a search index from your site's pages and provides a simple way for users to search through the content.
6+
7+
This plugin is built to work with the latest version of VuePress, but also maintains backward compatibility for VuePress versions up to **v2.0.0-beta.43**. It ensures smooth transitions for users upgrading their VuePress projects.
8+
9+
##### Features
10+
11+
- **Full-text Search**: Automatically generates a search index for your pages, allowing users to search through the text content of your site.
12+
- **VuePress v2 Compatibility**: Designed specifically for VuePress v2, ensuring full integration with the latest features and updates.
13+
- **HMR Support**: Includes Hot Module Replacement (HMR) code to allow live updates of the search index during development.
14+
- **Search Index Generation**: A script that generates the search index by extracting relevant data from your site's pages.
15+
16+
##### Installation
17+
18+
To install the plugin, follow these steps:
19+
20+
1. **Install the plugin** via npm:
21+
22+
```bash
23+
npm install vuepress-serach-plugin --save

eslint.config.mjs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ export default [
99
"**/node_modules",
1010
"tests/fixtures/**/*.json",
1111
"!playground/docs/.vuepress",
12-
"playground/docs/.vuepress/.temp",
13-
"playground/docs/.vuepress/.cache",
14-
"playground/docs/.vuepress/dist",
1512
],
1613
},
1714
{
@@ -73,14 +70,4 @@ export default [
7370
"@typescript-eslint/no-misused-promises": "off",
7471
},
7572
},
76-
{
77-
files: ["playground/**/*.js"],
78-
79-
rules: {
80-
"n/no-missing-import": "off",
81-
"n/no-unpublished-import": "off",
82-
"n/no-missing-require": "off",
83-
"n/no-unpublished-require": "off",
84-
},
85-
},
8673
];

package.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuepress-serach-plugin",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "a plugin for vuepress2 search.",
55
"files": [
66
"lib"
@@ -37,9 +37,7 @@
3737
},
3838
"keywords": [
3939
"vuepress",
40-
"vuepress-plugin",
41-
"full-text-search",
42-
"vuepress-next"
40+
"vuepress-plugin"
4341
],
4442
"author": "gspgsp",
4543
"license": "MIT",
@@ -56,7 +54,6 @@
5654
"vuepress": "^2.0.0-rc.18"
5755
},
5856
"devDependencies": {
59-
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
6057
"@types/chai": "^4.2.22",
6158
"@types/mocha": "^10.0.0",
6259
"@types/node": "^22.0.0",
@@ -66,14 +63,8 @@
6663
"cpx2": "^8.0.0",
6764
"eslint": "^9.6.0",
6865
"eslint-config-prettier": "^9.0.0",
69-
"eslint-plugin-jsdoc": "^50.0.0",
70-
"eslint-plugin-json-schema-validator": "^5.0.0",
71-
"eslint-plugin-jsonc": "^2.0.0",
7266
"eslint-plugin-n": "^17.0.0",
73-
"eslint-plugin-node-dependencies": "^0.12.0",
7467
"eslint-plugin-prettier": "^5.0.0",
75-
"eslint-plugin-regexp": "^2.0.0",
76-
"eslint-plugin-vue": "^9.0.0",
7768
"mocha": "^10.0.0",
7869
"mocha-chai-jest-snapshot": "^1.1.3",
7970
"nyc": "^17.0.0",
@@ -83,8 +74,6 @@
8374
"tsconfig-vuepress": "^5.0.0",
8475
"tsup": "^8.0.0",
8576
"typescript": "~5.6.0",
86-
"typescript-eslint": "^8.0.0",
87-
"vue-eslint-parser": "^9.0.0",
8877
"vuepress": "^2.0.0-rc.18"
8978
}
9079
}

src/client/engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
searchIndex as searchIndexRaw,
33
UPD_NAME,
44
// @ts-expect-error -- generated from prepare-search-index
5-
} from "@internal/vuepress-plugin-full-text-search2-search-index";
5+
} from "@internal/vuepress-search-plugin-index";
66
import { computed, ref, watch } from "vue";
77
import type { Ref } from "vue";
88
import type { PageContent, PageIndex } from "../types";

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function fullTextSearchPluginFunction(
2929
options: FullTextSearchPluginOptions | App = {},
3030
): PluginObject {
3131
return {
32-
name: "vuepress-plugin-full-text-search2",
32+
name: "vuepress-search-plugin",
3333

3434
define: {
3535
__SEARCH_LOCALES__: ("locales" in options ? options?.locales : {}) ?? {},

src/prepare-search-index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export async function prepareSearchIndex({
4646
// search index file content
4747
let content = `
4848
export const searchIndex = ${JSON.stringify(searchIndex, null, 2)}
49-
export const UPD_NAME = 'update-vuepress-plugin-full-text-search2-search-index'
49+
export const UPD_NAME = 'update-vuepress-search-plugin-index'
5050
`;
5151

5252
// inject HMR code
@@ -55,7 +55,7 @@ export const UPD_NAME = 'update-vuepress-plugin-full-text-search2-search-index'
5555
}
5656

5757
return app.writeTemp(
58-
"internal/vuepress-plugin-full-text-search2-search-index.js",
58+
"internal/vuepress-search-plugin-index.js",
5959
content,
6060
);
6161
}

0 commit comments

Comments
 (0)