From b9c6a29fdf040ead41cc4e5af9f0e334c19f3a15 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 24 Sep 2018 21:53:54 +0200 Subject: [PATCH] Update to newest lodash --- dist/converse.js | 181 +++++++++++++++++++--------------- docs/source/configuration.rst | 6 +- package-lock.json | 42 ++++---- package.json | 2 +- 4 files changed, 126 insertions(+), 105 deletions(-) diff --git a/dist/converse.js b/dist/converse.js index ead9aa1a9..2adc44d77 100644 --- a/dist/converse.js +++ b/dist/converse.js @@ -9629,7 +9629,7 @@ module.exports = isSymbol; var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.4'; + var VERSION = '4.17.10'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -9760,7 +9760,6 @@ module.exports = isSymbol; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, - reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** @@ -9860,8 +9859,8 @@ module.exports = isSymbol; reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)', - rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)', + rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', + rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; @@ -10054,6 +10053,14 @@ module.exports = isSymbol; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); @@ -10068,34 +10075,6 @@ module.exports = isSymbol; /*--------------------------------------------------------------------------*/ - /** - * Adds the key-value `pair` to `map`. - * - * @private - * @param {Object} map The map to modify. - * @param {Array} pair The key-value pair to add. - * @returns {Object} Returns `map`. - */ - function addMapEntry(map, pair) { - // Don't return `map.set` because it's not chainable in IE 11. - map.set(pair[0], pair[1]); - return map; - } - - /** - * Adds `value` to `set`. - * - * @private - * @param {Object} set The set to modify. - * @param {*} value The value to add. - * @returns {Object} Returns `set`. - */ - function addSetEntry(set, value) { - // Don't return `set.add` because it's not chainable in IE 11. - set.add(value); - return set; - } - /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. @@ -10862,6 +10841,20 @@ module.exports = isSymbol; return result; } + /** + * Gets the value at `key`, unless `key` is "__proto__". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function safeGet(object, key) { + return key == '__proto__' + ? undefined + : object[key]; + } + /** * Converts `set` to an array of its values. * @@ -12294,7 +12287,7 @@ module.exports = isSymbol; if (!cloneableTags[tag]) { return object ? value : {}; } - result = initCloneByTag(value, tag, baseClone, isDeep); + result = initCloneByTag(value, tag, isDeep); } } // Check for circular references and return its corresponding clone. @@ -12305,6 +12298,22 @@ module.exports = isSymbol; } stack.set(value, result); + if (isSet(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); + + return result; + } + + if (isMap(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + + return result; + } + var keysFunc = isFull ? (isFlat ? getAllKeysIn : getAllKeys) : (isFlat ? keysIn : keys); @@ -13232,7 +13241,7 @@ module.exports = isSymbol; } else { var newValue = customizer - ? customizer(object[key], srcValue, (key + ''), object, source, stack) + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { @@ -13259,8 +13268,8 @@ module.exports = isSymbol; * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = object[key], - srcValue = source[key], + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { @@ -14168,20 +14177,6 @@ module.exports = isSymbol; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } - /** - * Creates a clone of `map`. - * - * @private - * @param {Object} map The map to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned map. - */ - function cloneMap(map, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map); - return arrayReduce(array, addMapEntry, new map.constructor); - } - /** * Creates a clone of `regexp`. * @@ -14195,20 +14190,6 @@ module.exports = isSymbol; return result; } - /** - * Creates a clone of `set`. - * - * @private - * @param {Object} set The set to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned set. - */ - function cloneSet(set, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set); - return arrayReduce(array, addSetEntry, new set.constructor); - } - /** * Creates a clone of the `symbol` object. * @@ -15803,7 +15784,7 @@ module.exports = isSymbol; */ function initCloneArray(array) { var length = array.length, - result = array.constructor(length); + result = new array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { @@ -15830,16 +15811,15 @@ module.exports = isSymbol; * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. - * @param {Function} cloneFunc The function to clone values. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ - function initCloneByTag(object, tag, cloneFunc, isDeep) { + function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: @@ -15858,7 +15838,7 @@ module.exports = isSymbol; return cloneTypedArray(object, isDeep); case mapTag: - return cloneMap(object, isDeep, cloneFunc); + return new Ctor; case numberTag: case stringTag: @@ -15868,7 +15848,7 @@ module.exports = isSymbol; return cloneRegExp(object); case setTag: - return cloneSet(object, isDeep, cloneFunc); + return new Ctor; case symbolTag: return cloneSymbol(object); @@ -15915,10 +15895,13 @@ module.exports = isSymbol; * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { + var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -16368,11 +16351,11 @@ module.exports = isSymbol; */ var stringToPath = memoizeCapped(function(string) { var result = []; - if (reLeadingDot.test(string)) { + if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } - string.replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); @@ -19980,9 +19963,11 @@ module.exports = isSymbol; function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, - result = wait - timeSinceLastCall; + timeWaiting = wait - timeSinceLastCall; - return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -22414,9 +22399,35 @@ module.exports = isSymbol; * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ - var defaults = baseRest(function(args) { - args.push(undefined, customDefaultsAssignIn); - return apply(assignInWith, undefined, args); + var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; }); /** @@ -22813,6 +22824,11 @@ module.exports = isSymbol; * // => { '1': 'c', '2': 'b' } */ var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + result[value] = key; }, constant(identity)); @@ -22843,6 +22859,11 @@ module.exports = isSymbol; * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index b994cf066..bb9100636 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -7,10 +7,10 @@ Configuration ============= The included minified JavaScript and CSS files can be used for demoing or testing, but -you'll want to configure *Converse* to suit your needs before you deploy it +you'll want to configure Converse to suit your needs before you deploy it on your website. -*Converse* is passed its configuration settings when you call its *initialize* method. +Converse is passed its configuration settings when you call its *initialize* method. You'll most likely want to call the *initialize* method in your HTML page. For an example of how this is done, please see the bottom of the *./index.html* page. @@ -18,7 +18,7 @@ an example of how this is done, please see the bottom of the *./index.html* page Please refer to the `Configuration settings`_ section below for info on all the available configuration settings. -After you have configured *Converse*, you'll have to regenerate the minified +After you have configured Converse, you'll have to regenerate the minified JavaScript file so that it will include the new settings. Please refer to the :ref:`minification` section for more info on how to do this. diff --git a/package-lock.json b/package-lock.json index 9cdca2504..bfd9483c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1379,7 +1379,7 @@ "convert-source-map": "1.5.1", "debug": "2.6.9", "json5": "0.5.1", - "lodash": "4.17.4", + "lodash": "4.17.10", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", "private": "0.1.8", @@ -1415,7 +1415,7 @@ "babel-types": "6.26.0", "detect-indent": "4.0.0", "jsesc": "1.3.0", - "lodash": "4.17.4", + "lodash": "4.17.10", "source-map": "0.5.7", "trim-right": "1.0.1" }, @@ -1471,7 +1471,7 @@ "babel-helper-function-name": "6.24.1", "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.10" } }, "babel-helper-explode-assignable-expression": { @@ -1548,7 +1548,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.10" } }, "babel-helper-remap-async-to-generator": { @@ -1770,7 +1770,7 @@ "babel-template": "6.26.0", "babel-traverse": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.10" } }, "babel-plugin-transform-es2015-classes": { @@ -2161,7 +2161,7 @@ "babel-runtime": "6.26.0", "core-js": "2.5.7", "home-or-tmp": "2.0.0", - "lodash": "4.17.4", + "lodash": "4.17.10", "mkdirp": "0.5.1", "source-map-support": "0.4.18" } @@ -2186,7 +2186,7 @@ "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", - "lodash": "4.17.4" + "lodash": "4.17.10" }, "dependencies": { "babylon": { @@ -2211,7 +2211,7 @@ "debug": "2.6.9", "globals": "9.18.0", "invariant": "2.2.4", - "lodash": "4.17.4" + "lodash": "4.17.10" }, "dependencies": { "babylon": { @@ -2245,7 +2245,7 @@ "requires": { "babel-runtime": "6.26.0", "esutils": "2.0.2", - "lodash": "4.17.4", + "lodash": "4.17.10", "to-fast-properties": "1.0.3" }, "dependencies": { @@ -3676,7 +3676,7 @@ "js-yaml": "3.10.0", "json-stable-stringify-without-jsonify": "1.0.1", "levn": "0.3.0", - "lodash": "4.17.4", + "lodash": "4.17.10", "minimatch": "3.0.4", "mkdirp": "0.5.1", "natural-compare": "1.4.0", @@ -3716,7 +3716,7 @@ "integrity": "sha512-zxrCPhzaO+uwZmhngb+DEBzG40CorEY61FFI3iA21w+OfSxyiD8Qx06YfBpdFMM6bfRQ8FZWCGpYW/ZScY0WZA==", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "4.17.10" } }, "eslint-scope": { @@ -5185,7 +5185,7 @@ "integrity": "sha1-wWfSpTGcWg4JZO9qJbfC34mWyFw=", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "4.17.10" } }, "has": { @@ -5517,7 +5517,7 @@ "cli-width": "2.2.0", "external-editor": "2.2.0", "figures": "2.0.0", - "lodash": "4.17.4", + "lodash": "4.17.10", "mute-stream": "0.0.7", "run-async": "2.3.0", "rx-lite": "4.0.8", @@ -6020,7 +6020,7 @@ "babylon": "7.0.0-beta.47", "colors": "1.3.0", "flow-parser": "0.75.0", - "lodash": "4.17.4", + "lodash": "4.17.10", "micromatch": "2.3.11", "neo-async": "2.5.1", "node-dir": "0.1.8", @@ -6557,9 +6557,9 @@ } }, "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", "dev": true }, "lodash-template-loader": { @@ -6574,7 +6574,7 @@ "requires": { "fastparse": "1.1.1", "loader-utils": "0.2.17", - "lodash": "4.17.4", + "lodash": "4.17.10", "source-map": "0.5.7" }, "dependencies": { @@ -12761,7 +12761,7 @@ "integrity": "sha512-FgrSayXWfQQWL+RSDiCAFZbkEsY7hTZCiSuN9Ar/mcHpesxOPfrSzJKp+YbimOt9QFtSd+lR8Uob5tgkdQSOzg==", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "4.17.10" } }, "pluralize": { @@ -14134,7 +14134,7 @@ "ajv": "5.5.2", "ajv-keywords": "2.1.1", "chalk": "2.3.2", - "lodash": "4.17.4", + "lodash": "4.17.10", "slice-ansi": "1.0.0", "string-width": "2.1.1" }, @@ -14901,7 +14901,7 @@ "babylon": "6.18.0", "colors": "1.3.0", "flow-parser": "0.75.0", - "lodash": "4.17.4", + "lodash": "4.17.10", "micromatch": "2.3.11", "node-dir": "0.1.8", "nomnom": "1.8.1", diff --git a/package.json b/package.json index 701909f0a..5933733c5 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "jquery": "3.2.1", "jsdoc": "^3.5.5", "jshint": "^2.9.4", - "lodash": "4.17.4", + "lodash": "4.17.10", "lodash-template-loader": "^2.0.0", "lodash-template-webpack-loader": "jcbrand/lodash-template-webpack-loader", "long": "^3.1.0",