diff --git a/README.md b/README.md index c1170c7..c0de59a 100644 --- a/README.md +++ b/README.md @@ -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 -##### Supported Build Flags +### Supported Build Flags - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -2065,49 +2051,73 @@ The custom build will be saved to `dist/flexsearch.custom.xxxx.min.js` or when f - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + - - + + + + + + + + diff --git a/package.json b/package.json index 776c821..221fbb5 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/task/build.js b/task/build.js index 596bf2c..c836c21 100644 --- a/task/build.js +++ b/task/build.js @@ -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){
Flag Values Info
DEBUGtrue, falseOutput debug information to the console (default: false)
Feature Flags
SUPPORT_WORKERtrue, false
SUPPORT_ENCODERtrue, false
SUPPORT_CHARSETtrue, false
SUPPORT_CACHE true, falseDOM State Cache
SUPPORT_EVENTStrue, falseRouting & Event Delegation (template event bindings)
SUPPORT_KEYEDtrue, falseSupport for keyed recycling (reconciliation)
SUPPORT_WEB_COMPONENTStrue, falseSupport for web components (Shadow DOM)
SUPPORT_DOM_HELPERStrue, falseDOM Manipulation Helpers
SUPPORT_CACHE_HELPERStrue, falseDOM Cache Helpers
SUPPORT_POOLSSUPPORT_STORE true, falseSupport component pools for keyed and non-keyed recycle strategies
SUPPORT_REACTIVESUPPORT_SUGGESTION true, falseUse reactive data binding
REACTIVE_ONLYSUPPORT_SERIALIZE true, falseUse a full reactive approach for all views, exclude .render() and dependencies from build (default: false)
SUPPORT_CALLBACKSSUPPORT_DOCUMENT true, falseUse callbacks for specific render tasks
SUPPORT_COMPACT_TEMPLATESUPPORT_TAGS true, falseTurn on when templates are compiled with the compact or default strategy
SUPPORT_COMPILESUPPORT_PERSISTENT true, falseUse the runtime compiler
SUPPORT_KEYSTOREtrue, false
SUPPORT_COMPRESSIONtrue, false
SUPPORT_RESOLVERtrue, false

Compiler Flags
RELEASE




custom
custom.module
bundle
bundle.module
es5
light
DEBUGtrue, false Output debug information to the console (default: false)
RELEASE




custom
custom.module
bundle
bundle.module
es5
light
compact
POLYFILL true, false