@marko/translator-default 6.0.23 → 6.0.24
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/tag/attribute-tag.js +5 -51
- package/dist/tag/index.js +8 -4
- package/dist/taglib/core/conditional/translate-else.js +1 -5
- package/dist/taglib/core/conditional/util.js +1 -5
- package/dist/taglib/core/translate-for.js +1 -1
- package/dist/taglib/core/translate-while.js +1 -5
- package/dist/util/optimize-vdom-create.js +1 -0
- package/package.json +4 -4
@@ -27,7 +27,10 @@ function analyzeAttributeTags(rootTag) {
|
|
27
27
|
|
28
28
|
while (i < visit.length) {
|
29
29
|
const tag = visit[i++];
|
30
|
-
|
30
|
+
const attrTags = tag.node.body.attributeTags ?
|
31
|
+
tag.get("body").get("body") :
|
32
|
+
tag.get("attributeTags");
|
33
|
+
for (const child of attrTags) {
|
31
34
|
if ((0, _babelUtils.isAttributeTag)(child)) {
|
32
35
|
(0, _babelUtils.assertNoArgs)(child);
|
33
36
|
const tagDef = (0, _babelUtils.getTagDef)(child) || {};
|
@@ -89,17 +92,7 @@ function analyzeAttributeTags(rootTag) {
|
|
89
92
|
parentTags.push(child);
|
90
93
|
visit.push(child);
|
91
94
|
} else if ((0, _babelUtils.isTransparentTag)(child)) {
|
92
|
-
|
93
|
-
case ContentType.mixed:
|
94
|
-
throw child.buildCodeFrameError(
|
95
|
-
"Cannot mix @tags with other content when under a control flow."
|
96
|
-
);
|
97
|
-
case ContentType.attribute:
|
98
|
-
visit.push(child);
|
99
|
-
break;
|
100
|
-
case ContentType.render:
|
101
|
-
break;
|
102
|
-
}
|
95
|
+
visit.push(child);
|
103
96
|
}
|
104
97
|
}
|
105
98
|
}
|
@@ -147,45 +140,6 @@ function getAttrTagObject(tag) {
|
|
147
140
|
return attrs;
|
148
141
|
}
|
149
142
|
|
150
|
-
function getContentType(tag) {
|
151
|
-
const { node } = tag;
|
152
|
-
const cached = contentTypeCache.get(node);
|
153
|
-
if (cached !== undefined) return cached;
|
154
|
-
|
155
|
-
const body = tag.get("body").get("body");
|
156
|
-
let hasAttributeTag = false;
|
157
|
-
let hasRenderBody = false;
|
158
|
-
|
159
|
-
for (const child of body) {
|
160
|
-
if ((0, _babelUtils.isAttributeTag)(child)) {
|
161
|
-
hasAttributeTag = true;
|
162
|
-
} else if ((0, _babelUtils.isTransparentTag)(child)) {
|
163
|
-
switch (getContentType(child)) {
|
164
|
-
case ContentType.mixed:
|
165
|
-
contentTypeCache.set(node, ContentType.mixed);
|
166
|
-
return ContentType.mixed;
|
167
|
-
case ContentType.attribute:
|
168
|
-
hasAttributeTag = true;
|
169
|
-
break;
|
170
|
-
case ContentType.render:
|
171
|
-
hasRenderBody = true;
|
172
|
-
break;
|
173
|
-
}
|
174
|
-
} else if (!child.isMarkoScriptlet() && !child.isMarkoComment()) {
|
175
|
-
hasRenderBody = true;
|
176
|
-
}
|
177
|
-
|
178
|
-
if (hasAttributeTag && hasRenderBody) {
|
179
|
-
contentTypeCache.set(node, ContentType.mixed);
|
180
|
-
return ContentType.mixed;
|
181
|
-
}
|
182
|
-
}
|
183
|
-
|
184
|
-
const result = hasAttributeTag ? ContentType.attribute : ContentType.render;
|
185
|
-
contentTypeCache.set(node, result);
|
186
|
-
return result;
|
187
|
-
}
|
188
|
-
|
189
143
|
function removeDashes(str) {
|
190
144
|
return str.replace(/-([a-z])/g, matchToUpperCase);
|
191
145
|
}
|
package/dist/tag/index.js
CHANGED
@@ -50,8 +50,8 @@ var _nativeTag = _interopRequireDefault(require("./native-tag"));function _getRe
|
|
50
50
|
if (!(0, _babelUtils.isAttributeTag)(path)) {
|
51
51
|
if (
|
52
52
|
!tagDef &&
|
53
|
-
path.
|
54
|
-
path.
|
53
|
+
path.hub.file.markoOpts.ignoreUnrecognizedTags && (
|
54
|
+
path.node.attributeTags.length || path.node.body.attributeTags) &&
|
55
55
|
!(0, _babelUtils.isDynamicTag)(path))
|
56
56
|
{
|
57
57
|
moveIgnoredAttrTags(path);
|
@@ -261,9 +261,13 @@ function isMarkoFile(request) {
|
|
261
261
|
}
|
262
262
|
|
263
263
|
function moveIgnoredAttrTags(parentTag) {
|
264
|
-
|
264
|
+
const attrTags = parentTag.node.body.attributeTags ?
|
265
|
+
parentTag.get("body").get("body") :
|
266
|
+
parentTag.get("attributeTags");
|
265
267
|
|
266
|
-
|
268
|
+
if (!attrTags.length) return;
|
269
|
+
|
270
|
+
for (const attrTag of attrTags) {
|
267
271
|
if (attrTag.isMarkoTag()) {
|
268
272
|
if ((0, _babelUtils.isAttributeTag)(attrTag)) {
|
269
273
|
attrTag.set(
|
@@ -15,10 +15,6 @@ function exit(path) {
|
|
15
15
|
);
|
16
16
|
}
|
17
17
|
|
18
|
-
ifStatement.alternate = _compiler.types.blockStatement(
|
19
|
-
path.node.attributeTags.length ?
|
20
|
-
path.node.attributeTags :
|
21
|
-
path.node.body.body
|
22
|
-
);
|
18
|
+
ifStatement.alternate = _compiler.types.blockStatement(path.node.body.body);
|
23
19
|
path.remove();
|
24
20
|
}
|
@@ -12,11 +12,7 @@ function buildIfStatement(path, args) {
|
|
12
12
|
|
13
13
|
const ifStatement = _compiler.types.ifStatement(
|
14
14
|
args.length === 1 ? args[0] : _compiler.types.sequenceExpression(args),
|
15
|
-
_compiler.types.blockStatement(
|
16
|
-
path.node.attributeTags.length ?
|
17
|
-
path.node.attributeTags :
|
18
|
-
path.node.body.body
|
19
|
-
)
|
15
|
+
_compiler.types.blockStatement(path.node.body.body)
|
20
16
|
);
|
21
17
|
|
22
18
|
let nextPath = path.getNextSibling();
|
@@ -7,7 +7,7 @@ function exit(path) {
|
|
7
7
|
attributes,
|
8
8
|
body: { params }
|
9
9
|
} = node;
|
10
|
-
const body = node.
|
10
|
+
const body = node.body.body;
|
11
11
|
const namePath = path.get("name");
|
12
12
|
const ofAttr = findName(attributes, "of");
|
13
13
|
const inAttr = findName(attributes, "in");
|
@@ -24,11 +24,7 @@ function exit(path) {
|
|
24
24
|
(0, _withPreviousLocation.default)(
|
25
25
|
_compiler.types.whileStatement(
|
26
26
|
(0, _babelUtils.getArgOrSequence)(path),
|
27
|
-
_compiler.types.blockStatement(
|
28
|
-
path.node.attributeTags.length ?
|
29
|
-
path.node.attributeTags :
|
30
|
-
path.node.body.body
|
31
|
-
)
|
27
|
+
_compiler.types.blockStatement(path.node.body.body)
|
32
28
|
),
|
33
29
|
path.node
|
34
30
|
)
|
@@ -72,6 +72,7 @@ const analyzeStaticVisitor = {
|
|
72
72
|
let isStatic =
|
73
73
|
(0, _babelUtils.isNativeTag)(path) &&
|
74
74
|
!path.node.attributeTags.length &&
|
75
|
+
!path.node.body.attributeTags &&
|
75
76
|
!path.node.body.params.length &&
|
76
77
|
!path.node.arguments &&
|
77
78
|
!(0, _keyManager.hasUserKey)(path);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@marko/translator-default",
|
3
|
-
"version": "6.0.
|
3
|
+
"version": "6.0.24",
|
4
4
|
"description": "Translates Marko templates to the default Marko runtime.",
|
5
5
|
"keywords": [
|
6
6
|
"babel",
|
@@ -29,13 +29,13 @@
|
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
31
|
"@babel/runtime": "^7.26.0",
|
32
|
-
"@marko/babel-utils": "^6.5.
|
32
|
+
"@marko/babel-utils": "^6.5.12",
|
33
33
|
"magic-string": "^0.30.12",
|
34
34
|
"self-closing-tags": "^1.0.1"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
|
-
"@marko/compiler": "^5.37.
|
38
|
-
"marko": "^5.35.
|
37
|
+
"@marko/compiler": "^5.37.24",
|
38
|
+
"marko": "^5.35.33"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
41
|
"@marko/compiler": "^5.16.1",
|