1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-16 19:14:16 +02:00

readme custom builds

This commit is contained in:
Thomas Wilkerling
2025-03-10 18:14:28 +01:00
parent fc83234339
commit 8d43bdac97
3 changed files with 90 additions and 70 deletions

112
README.md
View File

@@ -1636,7 +1636,9 @@ If you get some good results please feel free to share your encoder.
## Fast-Boot Serialization for Server-Side-Rendering (PHP, Python, Ruby, Rust, Java, Go, Node.js, ...)
When using Server-Side-Rendering you can create a different export which instantly boot up. Especially when using Server-side rendered content, this could help to restore an index on page load.
> This is an experimental feature which probably might drop in future release. You're welcome to give some feedback.
When using Server-Side-Rendering you can create a different export which instantly boot up. Especially when using Server-side rendered content, this could help to restore a __static__ index on page load. Document-Indexes aren't supported yet for this method.
> When your index is too large you should use the default export/import mechanism.
@@ -2007,55 +2009,39 @@ The custom build will be saved to `dist/flexsearch.custom.xxxx.min.js` or when f
<a name="build-flags" id="builds"></a>
##### Supported Build Flags
### Supported Build Flags
<table>
<tr></tr>
<tr>
<td>Flag</td>
<td>Values</td>
<td>Info</td>
</tr>
<tr>
<td>DEBUG</td>
<td>true, <b>false</b></td>
<td>Output debug information to the console (default: false)</td>
<td colspan="3"><br><b>Feature Flags</b></td>
</tr>
<tr>
<td>SUPPORT_WORKER</td>
<td>true, false</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_ENCODER</td>
<td>true, false</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_CHARSET</td>
<td>true, false</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_CACHE</td>
<td>true, false</td>
<td>DOM State Cache</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_EVENTS</td>
<td>true, false</td>
<td>Routing & Event Delegation (template event bindings)</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_KEYED</td>
<td>true, false</td>
<td>Support for keyed recycling (reconciliation)</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_WEB_COMPONENTS</td>
<td>true, false</td>
<td>Support for web components (Shadow DOM)</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_DOM_HELPERS</td>
<td>true, false</td>
<td>DOM Manipulation Helpers</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_CACHE_HELPERS</td>
<td>true, false</td>
<td>DOM Cache Helpers</td>
<td></td>
</tr>
<tr></tr>
<tr>
@@ -2065,49 +2051,73 @@ The custom build will be saved to `dist/flexsearch.custom.xxxx.min.js` or when f
</tr>
<tr></tr>
<tr>
<td>SUPPORT_POOLS</td>
<td>SUPPORT_STORE</td>
<td>true, false</td>
<td>Support component pools for keyed and non-keyed recycle strategies</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_REACTIVE</td>
<td>SUPPORT_SUGGESTION</td>
<td>true, false</td>
<td>Use reactive data binding</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>REACTIVE_ONLY</td>
<td>SUPPORT_SERIALIZE</td>
<td>true, <b>false</b></td>
<td>Use a full reactive approach for all views, exclude <code>.render()</code> and dependencies from build (default: false)</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_CALLBACKS</td>
<td>SUPPORT_DOCUMENT</td>
<td>true, false</td>
<td>Use callbacks for specific render tasks</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_COMPACT_TEMPLATE</td>
<td>SUPPORT_TAGS</td>
<td>true, false</td>
<td>Turn on when templates are compiled with the <code>compact</code> or <code>default</code> strategy</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_COMPILE</td>
<td>SUPPORT_PERSISTENT</td>
<td>true, false</td>
<td>Use the runtime compiler</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_KEYSTORE</td>
<td>true, false</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_COMPRESSION</td>
<td>true, false</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_RESOLVER</td>
<td>true, false</td>
<td></td>
</tr>
<tr>
<td colspan="3"><br><b>Compiler Flags</b></td>
</tr>
<tr>
<td>RELEASE<br><br><br><br><br></td>
<td><b>custom</b><br>custom.module<br>bundle<br>bundle.module<br>es5<br>light</td>
<td>DEBUG</td>
<td>true, <b>false</b></td>
<td>Output debug information to the console (default: false)</td>
</tr>
<tr></tr>
<tr>
<td>RELEASE<br><br><br><br><br></td>
<td><b>custom</b><br>custom.module<br>bundle<br>bundle.module<br>es5<br>light<br>compact</td>
<td></td>
</tr>
<tr></tr>
<tr>
<td>POLYFILL</td>
<td>true, <b>false</b></td>

View File

@@ -52,7 +52,6 @@
"build:compact:debug": "node task/build RELEASE=compact DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:light": "node task/build RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:light:debug": "node task/build RELEASE=light DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:custom": "node task/build RELEASE=custom",
"build:es5": "node task/build RELEASE=es5 DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false LANGUAGE_OUT=ECMASCRIPT5_STRICT",
"build:es5:debug": "node task/build RELEASE=es5 DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT LANGUAGE_OUT=ECMASCRIPT5_STRICT",
"build:lang": "node task/build RELEASE=lang",
@@ -67,6 +66,7 @@
"build:module:light": "node task/build RELEASE=light.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=false SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:module:light:debug": "node task/build RELEASE=light.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=false SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:all": "npm run build:bundle && npm run build:bundle:debug && npm run build:light && npm run build:light:debug && npm run build:compact && npm run build:compact:debug && npm run build:module && npm run build:module:debug && npm run build:module:min && npm run build:module:bundle && npm run build:module:bundle:debug && npm run build:module:light && npm run build:module:light:debug && npm run build:module:compact && npm run build:module:compact:debug && npm run build:lang && npm run build:es5 && npm run build:es5:debug",
"build:custom": "node task/build RELEASE=custom",
"test": "cd test && npm install && npm run test"
},
"files": [

View File

@@ -35,7 +35,7 @@ let options = (function(argv){
if(++count > 2){
index = val.split('=');
index = val.split("=");
val = index[1];
index = index[0].toUpperCase();
@@ -122,7 +122,7 @@ if(!release.endsWith(".module")){
}
const custom = (!release || release.startsWith("custom"))
&& hashCode(parameter + flag_str).replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
&& hashCode(parameter + flag_str + JSON.stringify(options)).replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
if(custom){
release || (options["RELEASE"] = release = "custom");
@@ -376,24 +376,34 @@ else (async function(){
});
}());
// function hashCode(str) {
//
// let hash = 0, i, chr;
//
// if(str.length === 0){
//
// return hash;
// }
//
// for(i = 0; i < str.length; i++){
//
// chr = str.charCodeAt(i);
// hash = (hash << 5) - hash + chr;
// }
//
// hash = Math.abs(hash) >> 0;
//
// return hash.toString(16).substring(0, 5);
// }
function hashCode(str) {
let hash = 0, i, chr;
if(str.length === 0){
return hash;
console.log(str)
let range = 2 ** 16 - 1;
let crc = 0, bit = 16 + 1;
for(let i = 0; i < str.length; i++) {
crc = (crc * bit ^ str.charCodeAt(i)) & range;
}
for(i = 0; i < str.length; i++){
chr = str.charCodeAt(i);
hash = (hash << 5) - hash + chr;
}
hash = Math.abs(hash) >> 0;
return hash.toString(16).substring(0, 5);
return crc.toString(36).substring(0, 5);
}
function exec(prompt, callback){