@rhinostone/swig-django 2.9.3 → 2.9.5

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/index.js CHANGED
@@ -32,7 +32,7 @@ exports.name = 'django';
32
32
  *
33
33
  * @type {String}
34
34
  */
35
- exports.version = "2.9.3";
35
+ exports.version = "2.9.5";
36
36
 
37
37
  /**
38
38
  * Expression-level parser — Pratt-style recursive descent that consumes
@@ -27,6 +27,7 @@
27
27
 
28
28
  var ir = require('@rhinostone/swig-core/lib/ir');
29
29
  var utils = require('@rhinostone/swig-core/lib/utils');
30
+ var backend = require('@rhinostone/swig-core/lib/backend');
30
31
 
31
32
  exports.ends = true;
32
33
  exports.block = false;
@@ -53,17 +54,16 @@ exports.parse = function (str, line, parser, types, stack, opts) {
53
54
  /**
54
55
  * Emit the body into a shadowed `_output` local, then append the
55
56
  * whitespace-collapsed result to the real output. Returns an IRLegacyJS
56
- * node carrying the generated JS.
57
+ * node carrying the generated JS. On the async render path a body that
58
+ * awaits (an include in it) runs in an awaited async function
59
+ * (backend.iife).
57
60
  *
58
61
  * @return {object} IRLegacyJS node.
59
62
  */
60
63
  exports.compile = function (compiler, args, content, parents, options, blockName) {
61
64
  var bodyJS = compiler(content, parents, options, blockName);
62
65
  return ir.legacyJS(
63
- '_output += (function () {\n' +
64
- ' var _output = "";\n' +
65
- bodyJS +
66
- ' return _output.replace(/>\\s+</g, "><");\n' +
67
- '})();\n'
66
+ '_output += ' +
67
+ backend.iife('', ' var _output = "";\n' + bodyJS + ' return _output.replace(/>\\s+</g, "><");\n', '', options) + ';\n'
68
68
  );
69
69
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinostone/swig-django",
3
- "version": "2.9.3",
3
+ "version": "2.9.5",
4
4
  "description": "Django-syntax frontend for the @rhinostone/swig-core template engine. Part of the @rhinostone/swig multi-flavor family.",
5
5
  "keywords": [
6
6
  "template",
@@ -22,7 +22,7 @@
22
22
  "node": ">=12"
23
23
  },
24
24
  "peerDependencies": {
25
- "@rhinostone/swig-core": "2.9.3"
25
+ "@rhinostone/swig-core": "2.9.5"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"