Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
docs/
test/env/file_list.json
build/lunr.temp.js
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ release: lunr.js lunr.min.js bower.json package.json component.json docs
lunr.js: $(SRC)
cat build/wrapper_start $^ build/wrapper_end | \
sed "s/@YEAR/${YEAR}/" | \
sed "s/@VERSION/${VERSION}/" > $@
sed "s/@VERSION/${VERSION}/" > \
build/lunr.temp.js
npx rollup --input build/lunr.temp.js --config build/rollup.config.js

lunr.min.js: lunr.js
${UGLIFYJS} --compress --mangle --comments < $< > $@
Expand Down Expand Up @@ -80,6 +82,7 @@ clean:
rm -f lunr{.min,}.js
rm -rf docs
rm *.json
rm -f build/lunr.temp.js

reset:
git checkout lunr.* *.json
Expand Down
15 changes: 15 additions & 0 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

export default {
input: 'lunr.js',
output: [
{
file: 'lunr.js',
format: 'umd',
name: 'lunr'
},
{
file: 'lunr.es6.js',
format: 'esm'
}
]
};
29 changes: 1 addition & 28 deletions build/wrapper_end
Original file line number Diff line number Diff line change
@@ -1,29 +1,2 @@

/**
* export the module via AMD, CommonJS or as a browser global
* Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
*/
;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(factory)
} else if (typeof exports === 'object') {
/**
* Node. Does not work with strict CommonJS, but
* only CommonJS-like enviroments that support module.exports,
* like Node.
*/
module.exports = factory()
} else {
// Browser globals (root is window)
root.lunr = factory()
}
}(this, function () {
/**
* Just return a value to define the module export.
* This example returns an object, but the module
* can return a function as the exported value.
*/
return lunr
}))
})();
export default lunr;
2 changes: 0 additions & 2 deletions build/wrapper_start
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
* @license MIT
*/

;(function(){

8 changes: 3 additions & 5 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ lunr.utils = {}
* @memberOf lunr.utils
* @function
*/
lunr.utils.warn = (function (global) {
lunr.utils.warn = function (message) {
/* eslint-disable no-console */
return function (message) {
if (global.console && console.warn) {
if ((typeof console !== 'undefined') && console.warn) {
console.warn(message)
}
}
/* eslint-enable no-console */
})(this)
}

/**
* Convert an object to a string.
Expand Down
Loading