@marko/translator-default 5.31.16 → 5.31.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,7 @@
10
10
  var _compiler = require("@marko/compiler");
11
11
  var _util = require("./util");
12
12
 
13
+ const attributeTagsForTag = new WeakMap();
13
14
  const contentTypeCache = new WeakMap();
14
15
  const ContentType = {
15
16
  attribute: 0,
@@ -51,7 +52,39 @@ function analyzeAttributeTags(rootTag) {
51
52
 
52
53
  const parentTag = (0, _babelUtils.findParentTag)(child);
53
54
  const parentTagExtra = parentTag.node.extra ||= {};
54
- parentTagExtra.hasAttributeTags = true;
55
+ const parentSeenAttributeTagProperties =
56
+ attributeTagsForTag.get(parentTag);
57
+ let hasAttributeTags = false;
58
+
59
+ if (!parentSeenAttributeTagProperties) {
60
+ parentTagExtra.hasAttributeTags = true;
61
+ attributeTagsForTag.set(parentTag, new Set([targetProperty]));
62
+ } else if (parentSeenAttributeTagProperties.has(targetProperty)) {
63
+ hasAttributeTags = true;
64
+ } else {
65
+ parentSeenAttributeTagProperties.add(targetProperty);
66
+ }
67
+
68
+ if (!hasAttributeTags) {
69
+ if (
70
+ parentTag.
71
+ get("attributes").
72
+ some(
73
+ (attr) =>
74
+ attr.isMarkoSpreadAttribute() ||
75
+ attr.node.name === targetProperty
76
+ ))
77
+ {
78
+ parentTag.pushContainer(
79
+ "attributes",
80
+ _compiler.types.markoAttribute(
81
+ targetProperty,
82
+ _compiler.types.unaryExpression("void", _compiler.types.numericLiteral(0))
83
+ )
84
+ );
85
+ }
86
+ }
87
+
55
88
  parentTags.push(child);
56
89
  visit.push(child);
57
90
  } else if ((0, _babelUtils.isTransparentTag)(child)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/translator-default",
3
- "version": "5.31.16",
3
+ "version": "5.31.17",
4
4
  "description": "Translates Marko templates to the default Marko runtime.",
5
5
  "keywords": [
6
6
  "babel",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@marko/compiler": "^5.34.7",
38
- "marko": "^5.32.11"
38
+ "marko": "^5.32.12"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@marko/compiler": "^5.16.1",