@rhinostone/swig-core 2.8.3 → 2.8.4

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.
package/lib/backend.js CHANGED
@@ -391,7 +391,8 @@ exports.compile = function (template, parents, options, blockName) {
391
391
  // else verbatim string fallback preserves the userland setTag
392
392
  // path (compile functions that still hand in raw JS-source
393
393
  // fragments). `resolveFrom` is a plain filesystem path that must
394
- // be escaped into a string literal — escapeTextValue below (backslash,
394
+ // be escaped into a string literal (a number is converted to a
395
+ // string first) — escapeTextValue below (backslash,
395
396
  // newline, double-quote) is the single chokepoint that does it for all
396
397
  // five node types, every flavor and userland setTag, so no unescaped
397
398
  // filename can break out of the literal (GHSA-q89c). `ignoreMissing` wraps
@@ -420,7 +421,7 @@ exports.compile = function (template, parents, options, blockName) {
420
421
  }
421
422
  out += (node.ignoreMissing ? ' try {\n' : '') +
422
423
  '_output += _swig.compileFile(' + incPathJS + ', {' +
423
- 'resolveFrom: "' + escapeTextValue(node.resolveFrom || '') + '"' +
424
+ 'resolveFrom: "' + escapeTextValue(String(node.resolveFrom || '')) + '"' +
424
425
  '})(' + incSelector + ');\n' +
425
426
  (node.ignoreMissing ? '} catch (e) {}\n' : '');
426
427
  return;
@@ -454,7 +455,7 @@ exports.compile = function (template, parents, options, blockName) {
454
455
  } else {
455
456
  incdSelector = '_utils.extend({}, _ctx, ' + incdCtxJS + ')';
456
457
  }
457
- var incdOpts = '{resolveFrom: "' + escapeTextValue(node.resolveFrom || '') + '"}';
458
+ var incdOpts = '{resolveFrom: "' + escapeTextValue(String(node.resolveFrom || '')) + '"}';
458
459
  out += (node.ignoreMissing ? ' try {\n' : '') +
459
460
  '_output += (await (await _swig.getTemplate(' + incdPathJS + ', ' + incdOpts + '))(' + incdSelector + ')).output;\n' +
460
461
  (node.ignoreMissing ? '} catch (e) {}\n' : '');
@@ -476,7 +477,7 @@ exports.compile = function (template, parents, options, blockName) {
476
477
  } else {
477
478
  impdPathJS = node.path;
478
479
  }
479
- var impdOpts = '{resolveFrom: "' + escapeTextValue(node.resolveFrom || '') + '"}';
480
+ var impdOpts = '{resolveFrom: "' + escapeTextValue(String(node.resolveFrom || '')) + '"}';
480
481
  out += '_ctx.' + node.alias + ' = (await (await _swig.getTemplate(' + impdPathJS + ', ' + impdOpts + '))(_ctx)).exports;\n';
481
482
  return;
482
483
  }
@@ -501,7 +502,7 @@ exports.compile = function (template, parents, options, blockName) {
501
502
  } else {
502
503
  fromdPathJS = node.path;
503
504
  }
504
- var fromdOpts = '{resolveFrom: "' + escapeTextValue(node.resolveFrom || '') + '"}';
505
+ var fromdOpts = '{resolveFrom: "' + escapeTextValue(String(node.resolveFrom || '')) + '"}';
505
506
  var fromdBindings = '';
506
507
  utils.each(fromdImports, function (entry) {
507
508
  var bindName = entry.alias || entry.name;
@@ -570,7 +571,7 @@ exports.compile = function (template, parents, options, blockName) {
570
571
  } else {
571
572
  extPathJS = node.path;
572
573
  }
573
- var extOpts = '{resolveFrom: "' + escapeTextValue(node.resolveFrom || '') + '"}';
574
+ var extOpts = '{resolveFrom: "' + escapeTextValue(String(node.resolveFrom || '')) + '"}';
574
575
  out += 'var _parentTpl = await _swig.getTemplate(' + extPathJS + ', ' + extOpts + ');\n';
575
576
  out += 'var _parentResult = await _parentTpl(_ctx, _mergedBlocks);\n';
576
577
  out += '_output = _parentResult.output;\n';
package/lib/index.js CHANGED
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * @type {String}
17
17
  */
18
- exports.version = "2.8.3";
18
+ exports.version = "2.8.4";
19
19
 
20
20
  exports.utils = require('./utils');
21
21
  exports.security = require('./security');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinostone/swig-core",
3
- "version": "2.8.3",
3
+ "version": "2.8.4",
4
4
  "description": "Shared IR, backend, and runtime for the @rhinostone/swig family of template engines.",
5
5
  "keywords": [
6
6
  "template",