handlebars_assets 0.23.7 → 0.23.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  /**!
2
2
 
3
3
  @license
4
- handlebars v4.5.3
4
+ handlebars v4.7.3
5
5
 
6
- Copyright (C) 2011-2017 by Yehuda Katz
6
+ Copyright (C) 2011-2019 by Yehuda Katz
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
@@ -95,7 +95,7 @@ return /******/ (function(modules) { // webpackBootstrap
95
95
  // Each of these augment the Handlebars object. No need to setup here.
96
96
  // (This is done to easily share code between commonjs and browse envs)
97
97
 
98
- var _handlebarsSafeString = __webpack_require__(32);
98
+ var _handlebarsSafeString = __webpack_require__(36);
99
99
 
100
100
  var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
101
101
 
@@ -107,11 +107,11 @@ return /******/ (function(modules) { // webpackBootstrap
107
107
 
108
108
  var Utils = _interopRequireWildcard(_handlebarsUtils);
109
109
 
110
- var _handlebarsRuntime = __webpack_require__(33);
110
+ var _handlebarsRuntime = __webpack_require__(37);
111
111
 
112
112
  var runtime = _interopRequireWildcard(_handlebarsRuntime);
113
113
 
114
- var _handlebarsNoConflict = __webpack_require__(38);
114
+ var _handlebarsNoConflict = __webpack_require__(43);
115
115
 
116
116
  var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
117
117
 
@@ -207,7 +207,9 @@ return /******/ (function(modules) { // webpackBootstrap
207
207
 
208
208
  var _logger2 = _interopRequireDefault(_logger);
209
209
 
210
- var VERSION = '4.5.3';
210
+ var _internalProtoAccess = __webpack_require__(32);
211
+
212
+ var VERSION = '4.7.3';
211
213
  exports.VERSION = VERSION;
212
214
  var COMPILER_REVISION = 8;
213
215
  exports.COMPILER_REVISION = COMPILER_REVISION;
@@ -283,6 +285,13 @@ return /******/ (function(modules) { // webpackBootstrap
283
285
  },
284
286
  unregisterDecorator: function unregisterDecorator(name) {
285
287
  delete this.decorators[name];
288
+ },
289
+ /**
290
+ * Reset the memory of illegal property accesses that have already been logged.
291
+ * @deprecated should only be used in handlebars test-cases
292
+ */
293
+ resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() {
294
+ _internalProtoAccess.resetLoggedProperties();
286
295
  }
287
296
  };
288
297
 
@@ -306,7 +315,6 @@ return /******/ (function(modules) { // webpackBootstrap
306
315
  exports.createFrame = createFrame;
307
316
  exports.blockParams = blockParams;
308
317
  exports.appendContextPath = appendContextPath;
309
-
310
318
  var escape = {
311
319
  '&': '&',
312
320
  '<': '&lt;',
@@ -430,7 +438,6 @@ return /******/ (function(modules) { // webpackBootstrap
430
438
  var _Object$defineProperty = __webpack_require__(6)['default'];
431
439
 
432
440
  exports.__esModule = true;
433
-
434
441
  var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack'];
435
442
 
436
443
  function Exception(message, node) {
@@ -978,7 +985,11 @@ return /******/ (function(modules) { // webpackBootstrap
978
985
  if (arguments.length != 2) {
979
986
  throw new _exception2['default']('#unless requires exactly one argument');
980
987
  }
981
- return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
988
+ return instance.helpers['if'].call(this, conditional, {
989
+ fn: options.inverse,
990
+ inverse: options.fn,
991
+ hash: options.hash
992
+ });
982
993
  });
983
994
  };
984
995
 
@@ -1021,22 +1032,19 @@ return /******/ (function(modules) { // webpackBootstrap
1021
1032
  'use strict';
1022
1033
 
1023
1034
  exports.__esModule = true;
1024
- var dangerousPropertyRegex = /^(constructor|__defineGetter__|__defineSetter__|__lookupGetter__|__proto__)$/;
1025
-
1026
- exports.dangerousPropertyRegex = dangerousPropertyRegex;
1027
1035
 
1028
1036
  exports['default'] = function (instance) {
1029
- instance.registerHelper('lookup', function (obj, field) {
1037
+ instance.registerHelper('lookup', function (obj, field, options) {
1030
1038
  if (!obj) {
1039
+ // Note for 5.0: Change to "obj == null" in 5.0
1031
1040
  return obj;
1032
1041
  }
1033
- if (dangerousPropertyRegex.test(String(field)) && !Object.prototype.propertyIsEnumerable.call(obj, field)) {
1034
- return undefined;
1035
- }
1036
- return obj[field];
1042
+ return options.lookupProperty(obj, field);
1037
1043
  });
1038
1044
  };
1039
1045
 
1046
+ module.exports = exports['default'];
1047
+
1040
1048
  /***/ }),
1041
1049
  /* 28 */
1042
1050
  /***/ (function(module, exports, __webpack_require__) {
@@ -1169,8 +1177,8 @@ return /******/ (function(modules) { // webpackBootstrap
1169
1177
 
1170
1178
  if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
1171
1179
  var method = logger.methodMap[level];
1180
+ // eslint-disable-next-line no-console
1172
1181
  if (!console[method]) {
1173
- // eslint-disable-line no-console
1174
1182
  method = 'log';
1175
1183
  }
1176
1184
 
@@ -1188,6 +1196,129 @@ return /******/ (function(modules) { // webpackBootstrap
1188
1196
 
1189
1197
  /***/ }),
1190
1198
  /* 32 */
1199
+ /***/ (function(module, exports, __webpack_require__) {
1200
+
1201
+ 'use strict';
1202
+
1203
+ var _Object$create = __webpack_require__(33)['default'];
1204
+
1205
+ var _Object$keys = __webpack_require__(12)['default'];
1206
+
1207
+ var _interopRequireWildcard = __webpack_require__(1)['default'];
1208
+
1209
+ exports.__esModule = true;
1210
+ exports.createProtoAccessControl = createProtoAccessControl;
1211
+ exports.resultIsAllowed = resultIsAllowed;
1212
+ exports.resetLoggedProperties = resetLoggedProperties;
1213
+
1214
+ var _createNewLookupObject = __webpack_require__(35);
1215
+
1216
+ var _logger = __webpack_require__(31);
1217
+
1218
+ var logger = _interopRequireWildcard(_logger);
1219
+
1220
+ var loggedProperties = _Object$create(null);
1221
+
1222
+ function createProtoAccessControl(runtimeOptions) {
1223
+ var defaultMethodWhiteList = _Object$create(null);
1224
+ defaultMethodWhiteList['constructor'] = false;
1225
+ defaultMethodWhiteList['__defineGetter__'] = false;
1226
+ defaultMethodWhiteList['__defineSetter__'] = false;
1227
+ defaultMethodWhiteList['__lookupGetter__'] = false;
1228
+
1229
+ var defaultPropertyWhiteList = _Object$create(null);
1230
+ // eslint-disable-next-line no-proto
1231
+ defaultPropertyWhiteList['__proto__'] = false;
1232
+
1233
+ return {
1234
+ properties: {
1235
+ whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties),
1236
+ defaultValue: runtimeOptions.allowProtoPropertiesByDefault
1237
+ },
1238
+ methods: {
1239
+ whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods),
1240
+ defaultValue: runtimeOptions.allowProtoMethodsByDefault
1241
+ }
1242
+ };
1243
+ }
1244
+
1245
+ function resultIsAllowed(result, protoAccessControl, propertyName) {
1246
+ if (typeof result === 'function') {
1247
+ return checkWhiteList(protoAccessControl.methods, propertyName);
1248
+ } else {
1249
+ return checkWhiteList(protoAccessControl.properties, propertyName);
1250
+ }
1251
+ }
1252
+
1253
+ function checkWhiteList(protoAccessControlForType, propertyName) {
1254
+ if (protoAccessControlForType.whitelist[propertyName] !== undefined) {
1255
+ return protoAccessControlForType.whitelist[propertyName] === true;
1256
+ }
1257
+ if (protoAccessControlForType.defaultValue !== undefined) {
1258
+ return protoAccessControlForType.defaultValue;
1259
+ }
1260
+ logUnexpecedPropertyAccessOnce(propertyName);
1261
+ return false;
1262
+ }
1263
+
1264
+ function logUnexpecedPropertyAccessOnce(propertyName) {
1265
+ if (loggedProperties[propertyName] !== true) {
1266
+ loggedProperties[propertyName] = true;
1267
+ logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details');
1268
+ }
1269
+ }
1270
+
1271
+ function resetLoggedProperties() {
1272
+ _Object$keys(loggedProperties).forEach(function (propertyName) {
1273
+ delete loggedProperties[propertyName];
1274
+ });
1275
+ }
1276
+
1277
+ /***/ }),
1278
+ /* 33 */
1279
+ /***/ (function(module, exports, __webpack_require__) {
1280
+
1281
+ module.exports = { "default": __webpack_require__(34), __esModule: true };
1282
+
1283
+ /***/ }),
1284
+ /* 34 */
1285
+ /***/ (function(module, exports, __webpack_require__) {
1286
+
1287
+ var $ = __webpack_require__(8);
1288
+ module.exports = function create(P, D){
1289
+ return $.create(P, D);
1290
+ };
1291
+
1292
+ /***/ }),
1293
+ /* 35 */
1294
+ /***/ (function(module, exports, __webpack_require__) {
1295
+
1296
+ 'use strict';
1297
+
1298
+ var _Object$create = __webpack_require__(33)['default'];
1299
+
1300
+ exports.__esModule = true;
1301
+ exports.createNewLookupObject = createNewLookupObject;
1302
+
1303
+ var _utils = __webpack_require__(4);
1304
+
1305
+ /**
1306
+ * Create a new object with "null"-prototype to avoid truthy results on prototype properties.
1307
+ * The resulting object can be used with "object[property]" to check if a property exists
1308
+ * @param {...object} sources a varargs parameter of source objects that will be merged
1309
+ * @returns {object}
1310
+ */
1311
+
1312
+ function createNewLookupObject() {
1313
+ for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) {
1314
+ sources[_key] = arguments[_key];
1315
+ }
1316
+
1317
+ return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources));
1318
+ }
1319
+
1320
+ /***/ }),
1321
+ /* 36 */
1191
1322
  /***/ (function(module, exports) {
1192
1323
 
1193
1324
  // Build out our basic SafeString type
@@ -1206,12 +1337,14 @@ return /******/ (function(modules) { // webpackBootstrap
1206
1337
  module.exports = exports['default'];
1207
1338
 
1208
1339
  /***/ }),
1209
- /* 33 */
1340
+ /* 37 */
1210
1341
  /***/ (function(module, exports, __webpack_require__) {
1211
1342
 
1212
1343
  'use strict';
1213
1344
 
1214
- var _Object$seal = __webpack_require__(34)['default'];
1345
+ var _Object$seal = __webpack_require__(38)['default'];
1346
+
1347
+ var _Object$keys = __webpack_require__(12)['default'];
1215
1348
 
1216
1349
  var _interopRequireWildcard = __webpack_require__(1)['default'];
1217
1350
 
@@ -1237,6 +1370,10 @@ return /******/ (function(modules) { // webpackBootstrap
1237
1370
 
1238
1371
  var _helpers = __webpack_require__(9);
1239
1372
 
1373
+ var _internalWrapHelper = __webpack_require__(42);
1374
+
1375
+ var _internalProtoAccess = __webpack_require__(32);
1376
+
1240
1377
  function checkRevision(compilerInfo) {
1241
1378
  var compilerRevision = compilerInfo && compilerInfo[0] || 1,
1242
1379
  currentRevision = _base.COMPILER_REVISION;
@@ -1256,7 +1393,6 @@ return /******/ (function(modules) { // webpackBootstrap
1256
1393
  }
1257
1394
 
1258
1395
  function template(templateSpec, env) {
1259
-
1260
1396
  /* istanbul ignore next */
1261
1397
  if (!env) {
1262
1398
  throw new _exception2['default']('No environment passed to template');
@@ -1283,13 +1419,16 @@ return /******/ (function(modules) { // webpackBootstrap
1283
1419
  }
1284
1420
  partial = env.VM.resolvePartial.call(this, partial, context, options);
1285
1421
 
1286
- var optionsWithHooks = Utils.extend({}, options, { hooks: this.hooks });
1422
+ var extendedOptions = Utils.extend({}, options, {
1423
+ hooks: this.hooks,
1424
+ protoAccessControl: this.protoAccessControl
1425
+ });
1287
1426
 
1288
- var result = env.VM.invokePartial.call(this, partial, context, optionsWithHooks);
1427
+ var result = env.VM.invokePartial.call(this, partial, context, extendedOptions);
1289
1428
 
1290
1429
  if (result == null && env.compile) {
1291
1430
  options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
1292
- result = options.partials[options.name](context, optionsWithHooks);
1431
+ result = options.partials[options.name](context, extendedOptions);
1293
1432
  }
1294
1433
  if (result != null) {
1295
1434
  if (options.indent) {
@@ -1313,14 +1452,31 @@ return /******/ (function(modules) { // webpackBootstrap
1313
1452
  var container = {
1314
1453
  strict: function strict(obj, name, loc) {
1315
1454
  if (!obj || !(name in obj)) {
1316
- throw new _exception2['default']('"' + name + '" not defined in ' + obj, { loc: loc });
1455
+ throw new _exception2['default']('"' + name + '" not defined in ' + obj, {
1456
+ loc: loc
1457
+ });
1317
1458
  }
1318
1459
  return obj[name];
1319
1460
  },
1461
+ lookupProperty: function lookupProperty(parent, propertyName) {
1462
+ var result = parent[propertyName];
1463
+ if (result == null) {
1464
+ return result;
1465
+ }
1466
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
1467
+ return result;
1468
+ }
1469
+
1470
+ if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) {
1471
+ return result;
1472
+ }
1473
+ return undefined;
1474
+ },
1320
1475
  lookup: function lookup(depths, name) {
1321
1476
  var len = depths.length;
1322
1477
  for (var i = 0; i < len; i++) {
1323
- if (depths[i] && depths[i][name] != null) {
1478
+ var result = depths[i] && container.lookupProperty(depths[i], name);
1479
+ if (result != null) {
1324
1480
  return depths[i][name];
1325
1481
  }
1326
1482
  }
@@ -1356,6 +1512,15 @@ return /******/ (function(modules) { // webpackBootstrap
1356
1512
  }
1357
1513
  return value;
1358
1514
  },
1515
+ mergeIfNeeded: function mergeIfNeeded(param, common) {
1516
+ var obj = param || common;
1517
+
1518
+ if (param && common && param !== common) {
1519
+ obj = Utils.extend({}, common, param);
1520
+ }
1521
+
1522
+ return obj;
1523
+ },
1359
1524
  // An empty object to use as replacement for null-contexts
1360
1525
  nullContext: _Object$seal({}),
1361
1526
 
@@ -1385,28 +1550,35 @@ return /******/ (function(modules) { // webpackBootstrap
1385
1550
  function main(context /*, options*/) {
1386
1551
  return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
1387
1552
  }
1553
+
1388
1554
  main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams);
1389
1555
  return main(context, options);
1390
1556
  }
1557
+
1391
1558
  ret.isTop = true;
1392
1559
 
1393
1560
  ret._setup = function (options) {
1394
1561
  if (!options.partial) {
1395
- container.helpers = Utils.extend({}, env.helpers, options.helpers);
1562
+ var mergedHelpers = Utils.extend({}, env.helpers, options.helpers);
1563
+ wrapHelpersToPassLookupProperty(mergedHelpers, container);
1564
+ container.helpers = mergedHelpers;
1396
1565
 
1397
1566
  if (templateSpec.usePartial) {
1398
- container.partials = Utils.extend({}, env.partials, options.partials);
1567
+ // Use mergeIfNeeded here to prevent compiling global partials multiple times
1568
+ container.partials = container.mergeIfNeeded(options.partials, env.partials);
1399
1569
  }
1400
1570
  if (templateSpec.usePartial || templateSpec.useDecorators) {
1401
1571
  container.decorators = Utils.extend({}, env.decorators, options.decorators);
1402
1572
  }
1403
1573
 
1404
1574
  container.hooks = {};
1575
+ container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options);
1405
1576
 
1406
1577
  var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7;
1407
1578
  _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers);
1408
1579
  _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers);
1409
1580
  } else {
1581
+ container.protoAccessControl = options.protoAccessControl; // internal option
1410
1582
  container.helpers = options.helpers;
1411
1583
  container.partials = options.partials;
1412
1584
  container.decorators = options.decorators;
@@ -1527,25 +1699,39 @@ return /******/ (function(modules) { // webpackBootstrap
1527
1699
  return prog;
1528
1700
  }
1529
1701
 
1702
+ function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
1703
+ _Object$keys(mergedHelpers).forEach(function (helperName) {
1704
+ var helper = mergedHelpers[helperName];
1705
+ mergedHelpers[helperName] = passLookupPropertyOption(helper, container);
1706
+ });
1707
+ }
1708
+
1709
+ function passLookupPropertyOption(helper, container) {
1710
+ var lookupProperty = container.lookupProperty;
1711
+ return _internalWrapHelper.wrapHelper(helper, function (options) {
1712
+ return Utils.extend({ lookupProperty: lookupProperty }, options);
1713
+ });
1714
+ }
1715
+
1530
1716
  /***/ }),
1531
- /* 34 */
1717
+ /* 38 */
1532
1718
  /***/ (function(module, exports, __webpack_require__) {
1533
1719
 
1534
- module.exports = { "default": __webpack_require__(35), __esModule: true };
1720
+ module.exports = { "default": __webpack_require__(39), __esModule: true };
1535
1721
 
1536
1722
  /***/ }),
1537
- /* 35 */
1723
+ /* 39 */
1538
1724
  /***/ (function(module, exports, __webpack_require__) {
1539
1725
 
1540
- __webpack_require__(36);
1726
+ __webpack_require__(40);
1541
1727
  module.exports = __webpack_require__(20).Object.seal;
1542
1728
 
1543
1729
  /***/ }),
1544
- /* 36 */
1730
+ /* 40 */
1545
1731
  /***/ (function(module, exports, __webpack_require__) {
1546
1732
 
1547
1733
  // 19.1.2.17 Object.seal(O)
1548
- var isObject = __webpack_require__(37);
1734
+ var isObject = __webpack_require__(41);
1549
1735
 
1550
1736
  __webpack_require__(17)('seal', function($seal){
1551
1737
  return function seal(it){
@@ -1554,7 +1740,7 @@ return /******/ (function(modules) { // webpackBootstrap
1554
1740
  });
1555
1741
 
1556
1742
  /***/ }),
1557
- /* 37 */
1743
+ /* 41 */
1558
1744
  /***/ (function(module, exports) {
1559
1745
 
1560
1746
  module.exports = function(it){
@@ -1562,12 +1748,34 @@ return /******/ (function(modules) { // webpackBootstrap
1562
1748
  };
1563
1749
 
1564
1750
  /***/ }),
1565
- /* 38 */
1751
+ /* 42 */
1566
1752
  /***/ (function(module, exports) {
1567
1753
 
1568
- /* WEBPACK VAR INJECTION */(function(global) {/* global window */
1569
1754
  'use strict';
1570
1755
 
1756
+ exports.__esModule = true;
1757
+ exports.wrapHelper = wrapHelper;
1758
+
1759
+ function wrapHelper(helper, transformOptionsFn) {
1760
+ if (typeof helper !== 'function') {
1761
+ // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639
1762
+ // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function.
1763
+ return helper;
1764
+ }
1765
+ var wrapper = function wrapper() /* dynamic arguments */{
1766
+ var options = arguments[arguments.length - 1];
1767
+ arguments[arguments.length - 1] = transformOptionsFn(options);
1768
+ return helper.apply(this, arguments);
1769
+ };
1770
+ return wrapper;
1771
+ }
1772
+
1773
+ /***/ }),
1774
+ /* 43 */
1775
+ /***/ (function(module, exports) {
1776
+
1777
+ /* WEBPACK VAR INJECTION */(function(global) {'use strict';
1778
+
1571
1779
  exports.__esModule = true;
1572
1780
 
1573
1781
  exports['default'] = function (Handlebars) {
@@ -1589,4 +1797,4 @@ return /******/ (function(modules) { // webpackBootstrap
1589
1797
  /***/ })
1590
1798
  /******/ ])
1591
1799
  });
1592
- ;
1800
+ ;