1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-01 18:03:56 +02:00

document resolver, reduce code duplication, refactoring

This commit is contained in:
Thomas Wilkerling
2025-03-19 14:33:22 +01:00
parent 0455fa4b74
commit d9f235ce3b
107 changed files with 11949 additions and 10740 deletions

View File

@@ -68,6 +68,11 @@ fs.existsSync("dist") || fs.mkdirSync("dist");
});
}
let content = fs.readFileSync("tmp/db/interface.js", "utf8");
content = content.replace(/import \{([^}]+)} from "\.\.\/type\.js";/, '');
fs.writeFileSync("tmp/db/interface.js", content);
//fs.copyFileSync("src/db/interface.js", "tmp/db/interface.js");
fs.copyFileSync("task/babel." + (debug ? "debug": (minify ? "min" : "bundle")) + ".json", "tmp/.babelrc");
fs.existsSync("dist/module" + (debug ? "-debug" : (minify ? "-min" : ""))) && fs.rmSync("dist/module" + (debug ? "-debug" : (minify ? "-min" : "")), { recursive: true });

View File

@@ -128,6 +128,18 @@ if(custom){
release || (options["RELEASE"] = release = "custom");
}
if(release === "custom"){
if(typeof options["DEBUG"] === "undefined"){
options["DEBUG"] = false;
}
if(typeof options["PROFILER"] === "undefined"){
options["PROFILER"] = false;
}
if(typeof options["POLYFILL"] === "undefined"){
options["POLYFILL"] = false;
}
}
if(release === "lang"){
//const charsets = Object.keys(supported_charset);
@@ -161,7 +173,6 @@ if(release === "lang"){
.replace('import StorageInterface from "./db/interface.js";', '');
fs.writeFileSync("tmp/type.js", content);
fs.writeFileSync("tmp/lang.js", `
import { EncoderOptions, EncoderSplitOptions } from "./type.js";
import lang from "./lang/${lang}.js";
@@ -406,10 +417,10 @@ else (async function(){
// fix closure compiler dynamic import
build = build.replace(/\(([a-z])=([a-z]).config\)&&\(([a-z])=([a-z])\)/, "($1=$2.config)&&($3=(await import($4))[\"default\"])");
//if(release === "bundle"){
if(options["SUPPORT_WORKER"]){
build = build.replace("(function(self){'use strict';", "(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;");
//build = build.replace("(function(self){", "(function _f(self){if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;");
//}
}
// replace the eval wrapper
build = build.replace(/\(0,eval\)\('([^']+)'\)/g, "$1");