From 81eaeec66a755a39fae608c9452e1e9df92935eb Mon Sep 17 00:00:00 2001 From: Tom Greenfield Date: Thu, 3 Oct 2019 10:43:07 +0100 Subject: [PATCH 1/5] Update dependencies & engines --- package.json | 92 ++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index f841f857b1..a41516f9e8 100644 --- a/package.json +++ b/package.json @@ -14,80 +14,80 @@ "framework": "2", "main": "index", "engines": { - "node": "8 || 10" + "node": "10 || 12" }, "scripts": { "test": "grunt test", "migrate": "migrate --config conf/migrate.json --template-file migrations/helpers/template.js" }, "dependencies": { - "archiver": "^2.1.1", - "async": "^2.6.1", + "archiver": "^3.1.1", + "async": "^3.1.0", "bcrypt-nodejs": "0.0.3", - "body-parser": "^1.18.3", - "bower": "^1.8.4", - "bytes": "^3.0.0", - "chalk": "^2.4.1", - "compression": "^1.7.2", - "connect-mongodb-session": "^2.0.5", + "body-parser": "^1.19.0", + "bower": "^1.8.8", + "bytes": "^3.1.0", + "chalk": "^2.4.2", + "compression": "^1.7.4", + "connect-mongodb-session": "^2.2.0", "consolidate": "^0.15.1", - "cookie-parser": "^1.4.3", - "email-templates": "^4.0.0", - "errorhandler": "^1.5.0", - "express": "^4.16.3", - "express-session": "^1.15.6", - "ffmpeg-static": "^2.4.0", + "cookie-parser": "^1.4.4", + "email-templates": "^6.0.2", + "errorhandler": "^1.5.1", + "express": "^4.17.1", + "express-session": "^1.16.2", + "ffmpeg-static": "^2.6.0", "ffprobe": "^1.1.0", "ffprobe-static": "^3.0.0", "fluent-ffmpeg": "^2.1.2", "formidable": "^1.2.1", - "fs-extra": "^6.0.1", - "glob": "^7.1.2", - "grunt": "^1.0.2", + "fs-extra": "^8.1.0", + "glob": "^7.1.4", + "grunt": "^1.0.4", "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-handlebars": "^1.0.0", + "grunt-contrib-handlebars": "^2.0.0", "grunt-contrib-requirejs": "^1.0.0", "grunt-merge-json": "^0.9.7", "grunt-mocha-test": "^0.13.3", - "handlebars": "^4.0.11", - "handlebars-form-helpers": "^0.1.3", - "hbs": "^4.0.1", + "handlebars": "^4.4.0", + "handlebars-form-helpers": "^0.1.4", + "hbs": "^4.0.5", "jshint-stylish": "^2.2.1", "json-schema-mapper": "0.0.2", - "junk": "^2.1.0", - "less": "^3.0.4", - "log-update": "^2.3.0", + "junk": "^3.1.0", + "less": "^3.10.3", + "log-update": "^3.3.0", "matchdep": "^2.0.0", - "method-override": "^2.3.10", - "migrate-mongoose": "^3.2.2", - "mime": "^2.3.1", - "moment": "^2.22.1", + "method-override": "^3.0.0", + "migrate-mongoose": "^4.0.0", + "mime": "^2.4.4", + "moment": "^2.24.0", "mongodb-uri": "^0.9.7", - "mongoose": "^5.5.8", - "morgan": "^1.9.0", - "multer": "^1.3.0", - "needle": "^2.2.1", - "node-polyglot": "^2.2.2", - "nodemailer": "^4.6.4", + "mongoose": "^5.7.3", + "morgan": "^1.9.1", + "multer": "^1.4.2", + "needle": "^2.4.0", + "node-polyglot": "^2.4.0", + "nodemailer": "^6.3.0", "optimist": "^0.6.1", "passport": "^0.4.0", "prompt": "^1.0.0", - "request": "^2.87.0", - "semver": "^5.5.0", + "request": "^2.88.0", + "semver": "^6.3.0", "serve-favicon": "^2.5.0", "traverse": "^0.6.6", - "underscore": "^1.9.0", + "underscore": "^1.9.1", "unzip": "^0.1.11", - "validator": "^10.2.0", - "winston": "3", - "yauzl": "^2.9.1" + "validator": "^11.1.0", + "winston": "^3.2.1", + "yauzl": "^2.10.0" }, "devDependencies": { - "mocha": "^5.2.0", - "mocha-multi": "^1.0.1", + "mocha": "^6.2.1", + "mocha-multi": "^1.1.3", "mocha-simple-html-reporter": "^1.1.0", - "mongodb": "^3.0.10", - "should": "^13.2.1", - "supertest": "^3.1.0" + "mongodb": "^3.3.2", + "should": "^13.2.3", + "supertest": "^4.0.2" } } From d272834352be27bf61c9084539a631bf5c3a19c3 Mon Sep 17 00:00:00 2001 From: Tom Greenfield Date: Thu, 3 Oct 2019 10:46:57 +0100 Subject: [PATCH 2/5] =?UTF-8?q?unzip=20=E2=86=92=20unzipper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See node-unzip/issues/122 --- package.json | 2 +- plugins/content/bower/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a41516f9e8..9a81b1056d 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "serve-favicon": "^2.5.0", "traverse": "^0.6.6", "underscore": "^1.9.1", - "unzip": "^0.1.11", + "unzipper": "^0.10.5", "validator": "^11.1.0", "winston": "^3.2.1", "yauzl": "^2.10.0" diff --git a/plugins/content/bower/index.js b/plugins/content/bower/index.js index 4f8cc970b8..ee6302ac31 100644 --- a/plugins/content/bower/index.js +++ b/plugins/content/bower/index.js @@ -27,7 +27,7 @@ var origin = require('../../../'), _ = require('underscore'), util = require('util'), path = require('path'), - unzip = require('unzip'), + unzip = require('unzipper'), exec = require('child_process').exec, IncomingForm = require('formidable').IncomingForm, installHelpers = require('../../../lib/installHelpers'), From a823fa1bb8f2978eeab354841c5d31ad77a3dbce Mon Sep 17 00:00:00 2001 From: Tom Greenfield Date: Thu, 3 Oct 2019 10:48:18 +0100 Subject: [PATCH 3/5] Upgrade Handlebars --- frontend/src/libraries/handlebars.js | 186 ++++++++++++++++++--------- 1 file changed, 124 insertions(+), 62 deletions(-) diff --git a/frontend/src/libraries/handlebars.js b/frontend/src/libraries/handlebars.js index 6fc8bcb6eb..f3d6a8eabe 100644 --- a/frontend/src/libraries/handlebars.js +++ b/frontend/src/libraries/handlebars.js @@ -1,7 +1,7 @@ /**! @license - handlebars v4.0.11 + handlebars v4.4.0 Copyright (C) 2011-2017 by Yehuda Katz @@ -275,11 +275,13 @@ return /******/ (function(modules) { // webpackBootstrap var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.0.11'; + var VERSION = '4.4.0'; exports.VERSION = VERSION; - var COMPILER_REVISION = 7; - + var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; + var LAST_COMPATIBLE_COMPILER_REVISION = 7; + + exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', @@ -287,7 +289,8 @@ return /******/ (function(modules) { // webpackBootstrap 4: '== 1.x.x', 5: '== 2.0.0-alpha.x', 6: '>= 2.0.0-beta.1', - 7: '>= 4.0.0' + 7: '>= 4.0.0 <4.3.0', + 8: '>= 4.3.0' }; exports.REVISION_CHANGES = REVISION_CHANGES; @@ -371,6 +374,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.createFrame = createFrame; exports.blockParams = blockParams; exports.appendContextPath = appendContextPath; + var escape = { '&': '&', '<': '<', @@ -588,6 +592,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultHelpers = registerDefaultHelpers; + exports.moveHelperToHooks = moveHelperToHooks; var _helpersBlockHelperMissing = __webpack_require__(11); @@ -627,6 +632,15 @@ return /******/ (function(modules) { // webpackBootstrap _helpersWith2['default'](instance); } + function moveHelperToHooks(instance, helperName, keepHelper) { + if (instance.helpers[helperName]) { + instance.hooks[helperName] = instance.helpers[helperName]; + if (!keepHelper) { + delete instance.helpers[helperName]; + } + } + } + /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { @@ -674,7 +688,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 12 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; var _interopRequireDefault = __webpack_require__(1)['default']; @@ -736,6 +750,16 @@ return /******/ (function(modules) { // webpackBootstrap execIteration(i, i, i === context.length - 1); } } + } else if (global.Symbol && context[global.Symbol.iterator]) { + var newContext = []; + var iterator = context[global.Symbol.iterator](); + for (var it = iterator.next(); !it.done; it = iterator.next()) { + newContext.push(it.value); + } + context = newContext; + for (var j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } } else { var priorKey = undefined; @@ -766,6 +790,7 @@ return /******/ (function(modules) { // webpackBootstrap }; module.exports = exports['default']; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 13 */ @@ -868,7 +893,13 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = function (instance) { instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; + if (!obj) { + return obj; + } + if (field === 'constructor' && !obj.propertyIsEnumerable(field)) { + return undefined; + } + return obj[field]; }); }; @@ -1063,23 +1094,28 @@ return /******/ (function(modules) { // webpackBootstrap var _base = __webpack_require__(4); + var _helpers = __webpack_require__(10); + function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } + if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { + return; + } + + if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { + var runtimeVersions = _base.REVISION_CHANGES[currentRevision], + compilerVersions = _base.REVISION_CHANGES[compilerRevision]; + throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); } } function template(templateSpec, env) { + /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); @@ -1091,9 +1127,12 @@ return /******/ (function(modules) { // webpackBootstrap templateSpec.main.decorator = templateSpec.main_d; // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. + // for external users to override these as pseudo-supported APIs. env.VM.checkRevision(templateSpec.compiler); + // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) + var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; + function invokePartialWrapper(partial, context, options) { if (options.hash) { context = Utils.extend({}, context, options.hash); @@ -1101,13 +1140,15 @@ return /******/ (function(modules) { // webpackBootstrap options.ids[0] = true; } } - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); + + var optionsWithHooks = Utils.extend({}, options, { hooks: this.hooks }); + + var result = env.VM.invokePartial.call(this, partial, context, optionsWithHooks); if (result == null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); + result = options.partials[options.name](context, optionsWithHooks); } if (result != null) { if (options.indent) { @@ -1174,15 +1215,6 @@ return /******/ (function(modules) { // webpackBootstrap } return value; }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, // An empty object to use as replacement for null-contexts nullContext: _Object$seal({}), @@ -1219,18 +1251,25 @@ return /******/ (function(modules) { // webpackBootstrap ret._setup = function (options) { if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); + container.helpers = Utils.extend({}, env.helpers, options.helpers); if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); + container.partials = Utils.extend({}, env.partials, options.partials); } if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = container.merge(options.decorators, env.decorators); + container.decorators = Utils.extend({}, env.decorators, options.decorators); } + + container.hooks = {}; + + var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; + _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); + _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { container.helpers = options.helpers; container.partials = options.partials; container.decorators = options.decorators; + container.hooks = options.hooks; } }; @@ -1267,6 +1306,10 @@ return /******/ (function(modules) { // webpackBootstrap return prog; } + /** + * This is currently part of the official API, therefore implementation details should not be changed. + */ + function resolvePartial(partial, context, options) { if (!partial) { if (options.name === '@partial-block') { @@ -1629,8 +1672,7 @@ return /******/ (function(modules) { // webpackBootstrap symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$ - /**/) { + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; switch (yystate) { @@ -2167,11 +2209,10 @@ return /******/ (function(modules) { // webpackBootstrap this.begin(condition); } }; lexer.options = {}; - lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START - /**/) { + lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { function strip(start, end) { - return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); + return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); } var YYSTATE = YY_START; @@ -2208,7 +2249,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { return 15; } else { - yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); + strip(5, 9); return 'END_RAW_BLOCK'; } @@ -2571,7 +2612,7 @@ return /******/ (function(modules) { // webpackBootstrap return; } - // We omit the last node if it's whitespace only and not preceeded by a non-content node. + // We omit the last node if it's whitespace only and not preceded by a non-content node. var original = current.value; current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); current.leftStripped = current.value !== original; @@ -2772,7 +2813,7 @@ return /******/ (function(modules) { // webpackBootstrap function id(token) { if (/^\[.*\]$/.test(token)) { - return token.substr(1, token.length - 2); + return token.substring(1, token.length - 1); } else { return token; } @@ -2786,7 +2827,7 @@ return /******/ (function(modules) { // webpackBootstrap } function stripComment(comment) { - return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); + return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); } function preparePath(data, parts, loc) { @@ -2794,8 +2835,7 @@ return /******/ (function(modules) { // webpackBootstrap var original = data ? '@' : '', dig = [], - depth = 0, - depthString = ''; + depth = 0; for (var i = 0, l = parts.length; i < l; i++) { var part = parts[i].part, @@ -2810,7 +2850,6 @@ return /******/ (function(modules) { // webpackBootstrap throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); } else if (part === '..') { depth++; - depthString += '../'; } } else { dig.push(part); @@ -3045,11 +3084,11 @@ return /******/ (function(modules) { // webpackBootstrap 'lookup': true }; if (knownHelpers) { + // the next line should use "Object.keys", but the code has been like this a long time and changing it, might + // cause backwards-compatibility issues... It's an old library... + // eslint-disable-next-line guard-for-in for (var _name in knownHelpers) { - /* istanbul ignore else */ - if (_name in knownHelpers) { - this.options.knownHelpers[_name] = knownHelpers[_name]; - } + this.options.knownHelpers[_name] = knownHelpers[_name]; } } @@ -3565,10 +3604,19 @@ return /******/ (function(modules) { // webpackBootstrap // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function nameLookup(parent, name /* , type*/) { - if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return [parent, '.', name]; - } else { - return [parent, '[', JSON.stringify(name), ']']; + var isEnumerable = [this.aliasable('container.propertyIsEnumerable'), '.call(', parent, ',"constructor")']; + + if (name === 'constructor') { + return ['(', isEnumerable, '?', _actualLookup(), ' : undefined)']; + } + return _actualLookup(); + + function _actualLookup() { + if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + return [parent, '.', name]; + } else { + return [parent, '[', JSON.stringify(name), ']']; + } } }, depthedLookup: function depthedLookup(name) { @@ -3767,7 +3815,6 @@ return /******/ (function(modules) { // webpackBootstrap for (var alias in this.aliases) { // eslint-disable-line guard-for-in var node = this.aliases[alias]; - if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { varDeclarations += ', alias' + ++aliasCount + '=' + alias; node.children[0] = 'alias' + aliasCount; @@ -3862,7 +3909,7 @@ return /******/ (function(modules) { // webpackBootstrap // replace it on the stack with the result of properly // invoking blockHelperMissing. blockValue: function blockValue(name) { - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), params = [this.contextName(0)]; this.setupHelperArgs(name, 0, params); @@ -3880,7 +3927,7 @@ return /******/ (function(modules) { // webpackBootstrap // On stack, after, if lastHelper: value ambiguousBlockValue: function ambiguousBlockValue() { // We're being a bit cheeky and reusing the options value from the prior exec - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), params = [this.contextName(0)]; this.setupHelperArgs('', 0, params, true); @@ -4171,18 +4218,33 @@ return /******/ (function(modules) { // webpackBootstrap // If the helper is not found, `helperMissing` is called. invokeHelper: function invokeHelper(paramSize, name, isSimple) { var nonHelper = this.popStack(), - helper = this.setupHelper(paramSize, name), - simple = isSimple ? [helper.name, ' || '] : ''; + helper = this.setupHelper(paramSize, name); + + var possibleFunctionCalls = []; - var lookup = ['('].concat(simple, nonHelper); + if (isSimple) { + // direct call to helper + possibleFunctionCalls.push(helper.name); + } + // call a function from the input object + possibleFunctionCalls.push(nonHelper); if (!this.options.strict) { - lookup.push(' || ', this.aliasable('helpers.helperMissing')); + possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); } - lookup.push(')'); - this.push(this.source.functionCall(lookup, 'call', helper.callParams)); + var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; + var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); + this.push(functionCall); }, + itemsSeparatedBy: function itemsSeparatedBy(items, separator) { + var result = []; + result.push(items[0]); + for (var i = 1; i < items.length; i++) { + result.push(separator, items[i]); + } + return result; + }, // [invokeKnownHelper] // // On stack, before: hash, inverse, program, params..., ... @@ -4220,7 +4282,7 @@ return /******/ (function(modules) { // webpackBootstrap var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; if (!this.options.strict) { lookup[0] = '(helper = '; - lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing')); + lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); } this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); From b41f88067e715ac5cc5cfb6981348008f1ffd7e8 Mon Sep 17 00:00:00 2001 From: Tom Greenfield Date: Thu, 3 Oct 2019 10:50:14 +0100 Subject: [PATCH 4/5] Use new topology engine --- lib/dml/mongoose/index.js | 8 +++++--- test/entry.js | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/dml/mongoose/index.js b/lib/dml/mongoose/index.js index 23a3f51bfb..3e119f34a2 100644 --- a/lib/dml/mongoose/index.js +++ b/lib/dml/mongoose/index.js @@ -70,9 +70,11 @@ MongooseDB.prototype.connect = function(db) { dbPass = configuration.getConfig('dbPass'); dbReplicaset = configuration.getConfig('dbReplicaset'); dbConnectionUri = configuration.getConfig('dbConnectionUri'); - options = configuration.getConfig('dbOptions') || {}; - options.domainsEnabled = true; - options.useNewUrlParser = true; + options = { ...configuration.getConfig('dbOptions'), ...{ + domainsEnabled: true, + useNewUrlParser: true, + useUnifiedTopology: true + }}; // Construct the authentication part of the connection string. authenticationString = dbUser && dbPass ? dbUser + ':' + dbPass + '@' : ''; diff --git a/test/entry.js b/test/entry.js index a736337799..1e6dfb879c 100644 --- a/test/entry.js +++ b/test/entry.js @@ -112,7 +112,8 @@ function removeTestData(done) { var connStr = 'mongodb://' + testConfig.dbHost + ':' + testConfig.dbPort + '/' + testConfig.dbName; MongoClient.connect(connStr, { domainsEnabled: true, - useNewUrlParser: true + useNewUrlParser: true, + useUnifiedTopology: true }, function(error, client) { if(error) return cb(error); From 148bbf602d50d14b78c90d30c5e11d4b646201df Mon Sep 17 00:00:00 2001 From: Tom Greenfield Date: Thu, 10 Oct 2019 11:18:49 +0100 Subject: [PATCH 5/5] Update applyEachSeries calls See async/pull/1640 --- lib/installHelpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/installHelpers.js b/lib/installHelpers.js index 9264310dc1..93fb53399c 100644 --- a/lib/installHelpers.js +++ b/lib/installHelpers.js @@ -444,7 +444,7 @@ function installFramework(opts, callback) { if(fs.existsSync(opts.directory) && !opts.force) { return updateFramework(opts, callback); } - async.applyEachSeries([cloneRepo, updateFramework], opts, callback); + async.applyEachSeries([ cloneRepo, updateFramework ], opts)(callback); } function updateFramework(opts, callback) { @@ -456,7 +456,7 @@ function updateFramework(opts, callback) { installDependencies, purgeCourseFolder, updateFrameworkPlugins - ], opts, callback); + ], opts)(callback); } function checkOptions(opts, action, callback) {