1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-29 06:48:59 +02:00

bundle pre-release

This commit is contained in:
Thomas Wilkerling
2025-03-07 17:44:10 +01:00
parent 5bcbc72dac
commit 25e4b5d712
219 changed files with 44901 additions and 16106 deletions

View File

@@ -1,6 +1,7 @@
import Index from "../index.js";
import { IndexOptions } from "../type.js";
export default function (data) {
export default (async function (data) {
data = data.data;
@@ -13,19 +14,26 @@ export default function (data) {
switch (task) {
case "init":
const options = data.options || {},
factory = data.factory,
encode = options.encode;
/** @type IndexOptions */
let options = data.options || {},
filepath = options.config;
options.cache = /* normalize: */ /* collapse: */ /* normalize: */
/* collapse: */ /* normalize: */ /* collapse: */ /* normalize: */ /* collapse: */ /* collapse: */!1;
if (encode && 0 === encode.indexOf("function")) {
options.encode = Function("return " + encode)();
if (filepath) {
options = filepath;
// will be replaced after build with the line below because
// there is an issue with closure compiler dynamic import
//options = await import(filepath);
}
// deprecated:
// const encode = options.encode;
// if(encode && (encode.indexOf("function") === 0)){
// options.encode = Function("return " + encode)();
// }
const factory = data.factory;
if (factory) {
// export the FlexSearch global payload to "self"
@@ -41,6 +49,7 @@ export default function (data) {
self._index = new Index(options);
}
postMessage({ id: data.id });
break;
default:
@@ -49,4 +58,4 @@ export default function (data) {
postMessage("search" === task ? { id: id, msg: message } : { id: id });
}
}
});