@marko/translator-default 6.0.10 → 6.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,7 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
19
19
  } else {
20
20
  value.parentPath.remove();
21
21
  }
22
- } else {
22
+ } else if (!value.isTemplateLiteral()) {
23
23
  value.replaceWith(
24
24
  (0, _withPreviousLocation.default)(
25
25
  _compiler.types.callExpression(
@@ -19,7 +19,7 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
19
19
  } else {
20
20
  value.parentPath.remove();
21
21
  }
22
- } else {
22
+ } else if (!value.isTemplateLiteral()) {
23
23
  value.replaceWith(
24
24
  (0, _withPreviousLocation.default)(
25
25
  _compiler.types.callExpression(
@@ -1,6 +1,11 @@
1
1
  "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _babelUtils = require("@marko/babel-utils");
2
+
3
+
4
+
5
+
2
6
  var _compiler = require("@marko/compiler");
3
7
  var _attr = _interopRequireDefault(require("marko/src/runtime/html/helpers/attr"));
8
+ var _escapeQuotes = require("marko/src/runtime/html/helpers/escape-quotes");
4
9
 
5
10
  var _util = require("../util");
6
11
 
@@ -94,6 +99,32 @@ function _default(path, attrs) {
94
99
  }
95
100
 
96
101
  curString += (0, _attr.default)(name, computed);
102
+ } else if (value.type === "TemplateLiteral") {
103
+ curString += " " + name + '="';
104
+
105
+ for (let i = 0; i < value.expressions.length; i++) {
106
+ const quasi = value.quasis[i];
107
+ const expression = value.expressions[i];
108
+ curString += (0, _escapeQuotes.d)(quasi.value.cooked);
109
+ quasis.push(curString);
110
+ curString = "";
111
+ expressions.push(
112
+ _compiler.types.callExpression(
113
+ (0, _babelUtils.importNamed)(
114
+ file,
115
+ "marko/src/runtime/html/helpers/escape-quotes.js",
116
+ "d",
117
+ "marko_escape_double_quotes"
118
+ ),
119
+ [expression]
120
+ )
121
+ );
122
+ }
123
+
124
+ curString +=
125
+ (0, _escapeQuotes.d)(
126
+ value.quasis[value.expressions.length].value.cooked
127
+ ) + '"';
97
128
  } else {
98
129
  quasis.push(curString);
99
130
  curString = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/translator-default",
3
- "version": "6.0.10",
3
+ "version": "6.0.11",
4
4
  "description": "Translates Marko templates to the default Marko runtime.",
5
5
  "keywords": [
6
6
  "babel",
@@ -34,8 +34,8 @@
34
34
  "self-closing-tags": "^1.0.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@marko/compiler": "^5.37.8",
38
- "marko": "^5.35.12"
37
+ "@marko/compiler": "^5.37.9",
38
+ "marko": "^5.35.13"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@marko/compiler": "^5.16.1",