Merge pull request #2531 from overleaf/ho-restore-lodash-2526

Revert "Reverts move from underscore to lodash"

GitOrigin-RevId: 1ea964d5c98a85f9490c0e731d6a68335df93c67
This commit is contained in:
Henry Oswald 2020-01-16 13:09:47 +00:00 committed by Copybot
parent 94e3051d2e
commit fe8ef3f08f
8 changed files with 11 additions and 1714 deletions

View file

@ -7,9 +7,7 @@
*/
const version = {
ace: '1.4.5', // Upgrade instructions: https://github.com/overleaf/write_latex/wiki/Upgrading-Ace
fineuploader: '5.15.4',
// For frontend. Backend has a different version defined in package.json
underscore: '1.9.1'
fineuploader: '5.15.4'
}
module.exports = {

View file

@ -53,13 +53,13 @@ define(['ace/ace'], function() {
}
const commandFragment = getLastCommandFragment(lineUpToCursor)
const linesContainPackage = _.any(change.lines, line =>
const linesContainPackage = _.some(change.lines, line =>
line.match(/^\\usepackage(?:\[.{0,80}?])?{(.{0,80}?)}/)
)
const linesContainReqPackage = _.any(change.lines, line =>
const linesContainReqPackage = _.some(change.lines, line =>
line.match(/^\\RequirePackage(?:\[.{0,80}?])?{(.{0,80}?)}/)
)
const linesContainLabel = _.any(change.lines, line =>
const linesContainLabel = _.some(change.lines, line =>
line.match(/\\label{(.{0,80}?)}/)
)
const linesContainMeta =

View file

@ -38,7 +38,7 @@ define(['base'], App =>
}
metadata.getAllLabels = () =>
_.flatten(
_.flattenDeep(
(() => {
const result = []
for (let docId in state.documents) {

View file

@ -2,10 +2,10 @@ define([
'jquery',
'angular',
'angular-sanitize',
'lodash',
'libs/angular-autocomplete/angular-autocomplete',
'libs/ui-bootstrap',
'libs/ng-context-menu-0.1.4',
'libs/underscore-1.9.1',
'libs/jquery.storage',
'libs/angular-cookie',
'libs/passfield',

View file

@ -21,7 +21,7 @@ define(['base'], App =>
const regexBySpaceOrComma = /[\s,]+/
let emails = emailsString.split(regexBySpaceOrComma)
emails = _.map(emails, email => (email = email.trim()))
emails = _.select(emails, email => email.indexOf('@') !== -1)
emails = _.filter(emails, email => email.indexOf('@') !== -1)
return emails
}

View file

@ -36,7 +36,7 @@ define(['base'], function(App) {
const regexBySpaceOrComma = /[\s,]+/
let emails = emailsString.split(regexBySpaceOrComma)
emails = _.map(emails, email => (email = email.trim()))
emails = _.select(emails, email => email.indexOf('@') !== -1)
emails = _.filter(emails, email => email.indexOf('@') !== -1)
return emails
}

File diff suppressed because it is too large Load diff

View file

@ -167,11 +167,8 @@ module.exports = {
]
},
{
// Expose underscore global variable
test: path.join(
__dirname,
`frontend/js/vendor/libs/${PackageVersions.lib('underscore')}.js`
),
// Expose lodash global variable
test: require.resolve('lodash'),
use: [
{
loader: 'expose-loader',
@ -257,11 +254,5 @@ module.exports = {
// to provide support for non-Latin characters
{ from: 'node_modules/pdfjs-dist/cmaps', to: 'js/cmaps' }
])
],
// If underscore is required by another dependency *don't* include in the
// bundle and use the relevant global variable instead
externals: {
underscore: '_'
}
]
}