@vuepress-plume/plugin-search 1.0.0-rc.55 → 1.0.0-rc.57

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.
@@ -1,18 +1,3 @@
1
1
  import type { MaybeRef } from 'vue';
2
2
  import type { SearchBoxLocales } from '../../shared/index.js';
3
- export declare function useLocale(locales: MaybeRef<SearchBoxLocales>): import("vue").ComputedRef<Partial<{
4
- placeholder: string;
5
- buttonText: string;
6
- resetButtonTitle: string;
7
- backButtonTitle: string;
8
- noResultsText: string;
9
- footer: {
10
- selectText: string;
11
- selectKeyAriaLabel: string;
12
- navigateText: string;
13
- navigateUpKeyAriaLabel: string;
14
- navigateDownKeyAriaLabel: string;
15
- closeText: string;
16
- closeKeyAriaLabel: string;
17
- };
18
- }>>;
3
+ export declare function useLocale(locales: MaybeRef<SearchBoxLocales>): import("vue").ComputedRef<Partial<import("../../shared/index.js").SearchLocaleOptions>>;
@@ -1,5 +1,6 @@
1
1
  import MiniSearch from 'minisearch';
2
2
  import pMap from 'p-map';
3
+ import { colors, logger } from 'vuepress/utils';
3
4
  const SEARCH_INDEX_DIR = 'internal/minisearchIndex/';
4
5
  const indexByLocales = new Map();
5
6
  const indexCache = new Map();
@@ -24,11 +25,15 @@ function getIndexCache(filepath) {
24
25
  return index;
25
26
  }
26
27
  export async function prepareSearchIndex({ app, isSearchable, searchOptions, }) {
28
+ const start = performance.now();
27
29
  const pages = isSearchable ? app.pages.filter(isSearchable) : app.pages;
28
30
  await pMap(pages, p => indexFile(p, searchOptions), {
29
31
  concurrency: 64,
30
32
  });
31
33
  await writeTemp(app);
34
+ if (app.env.isDebug) {
35
+ logger.info(`\n[${colors.green('@vuepress-plume/plugin-search')}] prepare search time spent: ${(performance.now() - start).toFixed(2)}ms`);
36
+ }
32
37
  }
33
38
  export async function onSearchIndexUpdated(filepath, { app, isSearchable, searchOptions, }) {
34
39
  const pages = isSearchable ? app.pages.filter(isSearchable) : app.pages;
@@ -1,6 +1,6 @@
1
1
  import type { LocaleConfig, Page } from 'vuepress/core';
2
2
  import type { Options as MiniSearchOptions } from 'minisearch';
3
- export type SearchBoxLocales = LocaleConfig<{
3
+ export interface SearchLocaleOptions {
4
4
  placeholder: string;
5
5
  buttonText: string;
6
6
  resetButtonTitle: string;
@@ -15,7 +15,8 @@ export type SearchBoxLocales = LocaleConfig<{
15
15
  closeText: string;
16
16
  closeKeyAriaLabel: string;
17
17
  };
18
- }>;
18
+ }
19
+ export type SearchBoxLocales = LocaleConfig<SearchLocaleOptions>;
19
20
  export interface SearchPluginOptions extends SearchOptions {
20
21
  locales?: SearchBoxLocales;
21
22
  isSearchable?: (page: Page) => boolean;
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.55",
4
+ "version": "1.0.0-rc.57",
5
5
  "description": "The Plugin for VuePres 2 - local search",
6
6
  "author": "pengzhanbo <volodymyr@foxmail.com>",
7
7
  "license": "MIT",
@@ -31,10 +31,10 @@
31
31
  "lib"
32
32
  ],
33
33
  "peerDependencies": {
34
- "vuepress": "2.0.0-rc.9"
34
+ "vuepress": "2.0.0-rc.12"
35
35
  },
36
36
  "dependencies": {
37
- "@vuepress/helper": "2.0.0-rc.24",
37
+ "@vuepress/helper": "2.0.0-rc.31",
38
38
  "@vueuse/core": "^10.9.0",
39
39
  "@vueuse/integrations": "^10.9.0",
40
40
  "chokidar": "^3.6.0",
@@ -42,7 +42,7 @@
42
42
  "mark.js": "^8.11.1",
43
43
  "minisearch": "^6.3.0",
44
44
  "p-map": "^7.0.2",
45
- "vue": "^3.4.26"
45
+ "vue": "^3.4.27"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"