mvw-search-index 3.0.0 → 3.0.1
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/README.md +3 -0
- package/js/cli.js +2 -2
- package/js/href.js +1 -1
- package/js/index.d.ts +4 -5
- package/js/index.js +7 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -215,6 +215,9 @@ This rebuilds `docs/index.json` and serves [./docs](docs): a simple static site
|
|
|
215
215
|
|
|
216
216
|
## Releases
|
|
217
217
|
|
|
218
|
+
- **3.0.1**: Fixes all open SonarCloud issues - `node:` imports, `export … from` re-exports, `Object.hasOwn`,
|
|
219
|
+
`replaceAll`; CI installs with `--ignore-scripts` and pins third-party actions to commit SHAs; the demo page can be
|
|
220
|
+
zoomed and its search field has a label. No API or behaviour changes.
|
|
218
221
|
- **3.0.0**: Major overhaul - Promise based API, correct text extraction and lunr pipeline (stemming, stop words),
|
|
219
222
|
language support, field boosts, href options, a full-featured CLI. **Breaking** - see [UPGRADING.md](UPGRADING.md).
|
|
220
223
|
- **2.3.2 – 2.3.7**: Dependency updates.
|
package/js/cli.js
CHANGED
|
@@ -35,8 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
const commander_1 = require("commander");
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
38
|
+
const fs = __importStar(require("node:fs"));
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
40
|
const index_1 = require("./index");
|
|
41
41
|
// read at runtime: package.json is outside of the compiled sources
|
|
42
42
|
const { version } = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"));
|
package/js/href.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.toHref = toHref;
|
|
|
4
4
|
/** Turns the path of an indexed file into the `href` of its search result. */
|
|
5
5
|
function toHref(relativePath, options = {}) {
|
|
6
6
|
// Windows paths use backslashes, URLs never do.
|
|
7
|
-
let href = relativePath.
|
|
7
|
+
let href = relativePath.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
8
8
|
if (options.stripIndexHtml) {
|
|
9
9
|
href = href.replace(/(^|\/)index\.html?$/, "$1");
|
|
10
10
|
}
|
package/js/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as lunr from "lunr";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export type { HrefOptions };
|
|
2
|
+
import { type HrefOptions } from "./href";
|
|
3
|
+
export { DEFAULT_EXCLUDE_SELECTOR } from "./html";
|
|
4
|
+
export type { HrefOptions } from "./href";
|
|
5
|
+
export { DEFAULT_LANGUAGE } from "./language";
|
|
7
6
|
export declare interface IResultStore {
|
|
8
7
|
[key: string]: {
|
|
9
8
|
title: string;
|
package/js/index.js
CHANGED
|
@@ -36,14 +36,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.SearchIndex = exports.DEFAULT_BOOSTS = exports.DEFAULT_LANGUAGE = exports.DEFAULT_EXCLUDE_SELECTOR = void 0;
|
|
37
37
|
const cheerio = __importStar(require("cheerio"));
|
|
38
38
|
const glob_1 = require("glob");
|
|
39
|
-
const fs = __importStar(require("fs"));
|
|
40
|
-
const path = __importStar(require("path"));
|
|
39
|
+
const fs = __importStar(require("node:fs"));
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
41
|
const lunr = __importStar(require("lunr"));
|
|
42
42
|
const html_1 = require("./html");
|
|
43
|
-
Object.defineProperty(exports, "DEFAULT_EXCLUDE_SELECTOR", { enumerable: true, get: function () { return html_1.DEFAULT_EXCLUDE_SELECTOR; } });
|
|
44
43
|
const href_1 = require("./href");
|
|
45
44
|
const language_1 = require("./language");
|
|
46
|
-
|
|
45
|
+
var html_2 = require("./html");
|
|
46
|
+
Object.defineProperty(exports, "DEFAULT_EXCLUDE_SELECTOR", { enumerable: true, get: function () { return html_2.DEFAULT_EXCLUDE_SELECTOR; } });
|
|
47
|
+
var language_2 = require("./language");
|
|
48
|
+
Object.defineProperty(exports, "DEFAULT_LANGUAGE", { enumerable: true, get: function () { return language_2.DEFAULT_LANGUAGE; } });
|
|
47
49
|
const silentLogger = {
|
|
48
50
|
info: () => undefined,
|
|
49
51
|
warn: () => undefined,
|
|
@@ -80,7 +82,7 @@ class SearchIndex {
|
|
|
80
82
|
}
|
|
81
83
|
builder.ref("href");
|
|
82
84
|
files.forEach((info) => {
|
|
83
|
-
if (Object.
|
|
85
|
+
if (Object.hasOwn(this.store, info.href)) {
|
|
84
86
|
throw new Error(`Duplicate href "${info.href}": every document needs a unique href.`);
|
|
85
87
|
}
|
|
86
88
|
this.store[info.href] = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mvw-search-index",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Module to generate the search index using lunr.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"website",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"eslint": "10.12.0",
|
|
37
37
|
"serve": "14.2.6",
|
|
38
38
|
"typescript": "6.0.3",
|
|
39
|
-
"typescript-eslint": "8.71.
|
|
39
|
+
"typescript-eslint": "8.71.1",
|
|
40
40
|
"vitest": "5.0.3"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|