From 47f2f3db32cdfbfd9728e2955d555653a6092cd1 Mon Sep 17 00:00:00 2001 From: Grace Date: Mon, 15 Apr 2024 14:57:32 +0100 Subject: [PATCH] Replace to use lunr-languages --- package-lock.json | 12 ++++++------ package.json | 2 +- src/documentation/search/lunr-languages.d.ts | 8 ++++---- src/documentation/search/search.worker.de.ts | 2 +- src/documentation/search/search.worker.es.ts | 2 +- src/documentation/search/search.worker.fr.ts | 2 +- src/documentation/search/search.worker.ja.ts | 2 +- src/documentation/search/search.worker.ko.ts | 2 +- src/documentation/search/search.worker.nl.ts | 2 +- src/documentation/search/search.worker.test.ts | 4 ++-- src/documentation/search/search.worker.ts | 6 +++--- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index b8c3cf4ae..862699247 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,6 @@ "@codemirror/view": "^6.3.0", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", - "@microbit/lunr-languages": "^1.9.0-microbit.1", "@microbit/microbit-fs": "^0.9.2", "@sanity/block-content-to-react": "^3.0.0", "@sanity/image-url": "^1.0.1", @@ -45,6 +44,7 @@ "lodash.debounce": "^4.0.8", "lodash.sortby": "^4.7.0", "lunr": "^2.3.9", + "lunr-languages": "^1.14.0", "lzma": "^2.3.2", "marked": "^4.0.15", "mobile-drag-drop": "^2.3.0-rc.2", @@ -2750,11 +2750,6 @@ "@lezer/lr": "^1.0.0" } }, - "node_modules/@microbit/lunr-languages": { - "version": "1.9.0-microbit.1", - "resolved": "https://registry.npmjs.org/@microbit/lunr-languages/-/lunr-languages-1.9.0-microbit.1.tgz", - "integrity": "sha512-w2x66WuGvihCUFUBboJK8RRcCJlB+QdQ4QRYlRcljhxqYs+L2yMOvsWYoQGkuoC060YhB0SOEpgi6gmXvIA+SQ==" - }, "node_modules/@microbit/microbit-fs": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/@microbit/microbit-fs/-/microbit-fs-0.9.2.tgz", @@ -8044,6 +8039,11 @@ "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" }, + "node_modules/lunr-languages": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/lunr-languages/-/lunr-languages-1.14.0.tgz", + "integrity": "sha512-hWUAb2KqM3L7J5bcrngszzISY4BxrXn/Xhbb9TTCJYEGqlR1nG67/M14sp09+PTIRklobrn57IAxcdcO/ZFyNA==" + }, "node_modules/lz-string": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", diff --git a/package.json b/package.json index 394c01504..c4df05d20 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "@codemirror/view": "^6.3.0", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", - "@microbit/lunr-languages": "^1.9.0-microbit.1", "@microbit/microbit-fs": "^0.9.2", "@sanity/block-content-to-react": "^3.0.0", "@sanity/image-url": "^1.0.1", @@ -41,6 +40,7 @@ "lodash.debounce": "^4.0.8", "lodash.sortby": "^4.7.0", "lunr": "^2.3.9", + "lunr-languages": "^1.14.0", "lzma": "^2.3.2", "marked": "^4.0.15", "mobile-drag-drop": "^2.3.0-rc.2", diff --git a/src/documentation/search/lunr-languages.d.ts b/src/documentation/search/lunr-languages.d.ts index 3747b4b9c..2ad548262 100644 --- a/src/documentation/search/lunr-languages.d.ts +++ b/src/documentation/search/lunr-languages.d.ts @@ -3,11 +3,11 @@ * * SPDX-License-Identifier: MIT */ -declare module "@microbit/lunr-languages/lunr.stemmer.support"; -declare module "@microbit/lunr-languages/tinyseg"; -declare module "@microbit/lunr-languages/lunr.multi"; +declare module "lunr-languages/lunr.stemmer.support"; +declare module "lunr-languages/tinyseg"; +declare module "lunr-languages/lunr.multi"; -declare module "@microbit/lunr-languages/lunr.*" { +declare module "lunr-languages/lunr.*" { import lunr from "lunr"; function register(l: typeof lunr): void; export = register; diff --git a/src/documentation/search/search.worker.de.ts b/src/documentation/search/search.worker.de.ts index a2779e9a1..4c51d5a81 100644 --- a/src/documentation/search/search.worker.de.ts +++ b/src/documentation/search/search.worker.de.ts @@ -4,6 +4,6 @@ * SPDX-License-Identifier: MIT */ import { SearchWorker } from "./search.worker"; -import languageSupport from "@microbit/lunr-languages/lunr.de"; +import languageSupport from "lunr-languages/lunr.de"; new SearchWorker(self as DedicatedWorkerGlobalScope, "de", languageSupport); diff --git a/src/documentation/search/search.worker.es.ts b/src/documentation/search/search.worker.es.ts index 325a5b97e..47a65e29f 100644 --- a/src/documentation/search/search.worker.es.ts +++ b/src/documentation/search/search.worker.es.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ import { SearchWorker } from "./search.worker"; -import languageSupport from "@microbit/lunr-languages/lunr.es"; +import languageSupport from "lunr-languages/lunr.es"; // Note the language code is different to the app new SearchWorker(self as DedicatedWorkerGlobalScope, "es", languageSupport); diff --git a/src/documentation/search/search.worker.fr.ts b/src/documentation/search/search.worker.fr.ts index f64a62395..fbf9dc870 100644 --- a/src/documentation/search/search.worker.fr.ts +++ b/src/documentation/search/search.worker.fr.ts @@ -4,6 +4,6 @@ * SPDX-License-Identifier: MIT */ import { SearchWorker } from "./search.worker"; -import languageSupport from "@microbit/lunr-languages/lunr.fr"; +import languageSupport from "lunr-languages/lunr.fr"; new SearchWorker(self as DedicatedWorkerGlobalScope, "fr", languageSupport); diff --git a/src/documentation/search/search.worker.ja.ts b/src/documentation/search/search.worker.ja.ts index 2be8e15b8..8d3c5d55e 100644 --- a/src/documentation/search/search.worker.ja.ts +++ b/src/documentation/search/search.worker.ja.ts @@ -4,6 +4,6 @@ * SPDX-License-Identifier: MIT */ import { SearchWorker } from "./search.worker"; -import languageSupport from "@microbit/lunr-languages/lunr.ja"; +import languageSupport from "lunr-languages/lunr.ja"; new SearchWorker(self as DedicatedWorkerGlobalScope, "ja", languageSupport); diff --git a/src/documentation/search/search.worker.ko.ts b/src/documentation/search/search.worker.ko.ts index b33007236..581a219e4 100644 --- a/src/documentation/search/search.worker.ko.ts +++ b/src/documentation/search/search.worker.ko.ts @@ -4,6 +4,6 @@ * SPDX-License-Identifier: MIT */ import { SearchWorker } from "./search.worker"; -import languageSupport from "@microbit/lunr-languages/lunr.ko"; +import languageSupport from "lunr-languages/lunr.ko"; new SearchWorker(self as DedicatedWorkerGlobalScope, "ko", languageSupport); diff --git a/src/documentation/search/search.worker.nl.ts b/src/documentation/search/search.worker.nl.ts index 9050d06bb..eb8511bc0 100644 --- a/src/documentation/search/search.worker.nl.ts +++ b/src/documentation/search/search.worker.nl.ts @@ -4,6 +4,6 @@ * SPDX-License-Identifier: MIT */ import { SearchWorker } from "./search.worker"; -import languageSupport from "@microbit/lunr-languages/lunr.nl"; +import languageSupport from "lunr-languages/lunr.nl"; new SearchWorker(self as DedicatedWorkerGlobalScope, "nl", languageSupport); diff --git a/src/documentation/search/search.worker.test.ts b/src/documentation/search/search.worker.test.ts index 107a75a05..d88b70b8c 100644 --- a/src/documentation/search/search.worker.test.ts +++ b/src/documentation/search/search.worker.test.ts @@ -7,7 +7,7 @@ import lunr from "lunr"; import { ApiDocsResponse } from "../../language-server/apidocs"; import { Toolkit } from "../reference/model"; import { IndexMessage } from "./common"; -import lunrJa from "@microbit/lunr-languages/lunr.ja"; +import lunrJa from "lunr-languages/lunr.ja"; import { buildIndex, buildSearchIndex, @@ -15,7 +15,7 @@ import { SearchWorker, } from "./search.worker"; import { vi } from "vitest"; -import frLanguageSupport from "@microbit/lunr-languages/lunr.fr"; +import frLanguageSupport from "lunr-languages/lunr.fr"; const searchableReferenceContent: SearchableContent[] = [ { diff --git a/src/documentation/search/search.worker.ts b/src/documentation/search/search.worker.ts index 52fac6fa0..11484c652 100644 --- a/src/documentation/search/search.worker.ts +++ b/src/documentation/search/search.worker.ts @@ -3,9 +3,9 @@ * * SPDX-License-Identifier: MIT */ -import multi from "@microbit/lunr-languages/lunr.multi"; -import stemmerSupport from "@microbit/lunr-languages/lunr.stemmer.support"; -import tinyseg from "@microbit/lunr-languages/tinyseg"; +import multi from "lunr-languages/lunr.multi"; +import stemmerSupport from "lunr-languages/lunr.stemmer.support"; +import tinyseg from "lunr-languages/tinyseg"; import lunr from "lunr"; import { splitDocString } from "../../editor/codemirror/language-server/docstrings"; import type {