@marko/translator-default 5.31.15 → 5.31.17
Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js
CHANGED
@@ -504,8 +504,7 @@ function getRuntimeEntryFiles(output, optimize) {
|
|
504
504
|
`${base}runtime/vdom/index.js`,
|
505
505
|
`${base}runtime/vdom/hot-reload.js`,
|
506
506
|
`${base}runtime/vdom/helpers/attrs.js`,
|
507
|
-
`${base}runtime/vdom/helpers/const-element.js
|
508
|
-
`${base}runtime/vdom/preserve-attrs.js`])];
|
507
|
+
`${base}runtime/vdom/helpers/const-element.js`])];
|
509
508
|
|
510
509
|
|
511
510
|
}
|
@@ -1,25 +1,12 @@
|
|
1
|
-
"use strict";exports.__esModule = true;exports.default = void 0;
|
2
|
-
|
3
|
-
const hasMonkeyPatch = new WeakSet();
|
4
|
-
|
5
|
-
/**
|
1
|
+
"use strict";exports.__esModule = true;exports.default = void 0; /**
|
6
2
|
* Does nothing in html mode.
|
7
3
|
*/var _default = exports.default =
|
8
4
|
{
|
9
5
|
exit(tag, attr) {
|
10
|
-
const {
|
11
|
-
node,
|
12
|
-
hub: { file }
|
13
|
-
} = tag;
|
14
|
-
const isVDOM = file.markoOpts.output !== "html";
|
6
|
+
const { node } = tag;
|
15
7
|
|
16
8
|
if (!node.preserveAttrs) {
|
17
9
|
node.preserveAttrs = [];
|
18
|
-
|
19
|
-
if (isVDOM && !hasMonkeyPatch.has(file)) {
|
20
|
-
hasMonkeyPatch.add(file);
|
21
|
-
(0, _babelUtils.importDefault)(file, "marko/src/runtime/vdom/preserve-attrs.js");
|
22
|
-
}
|
23
10
|
}
|
24
11
|
|
25
12
|
node.preserveAttrs.push(attr.node.name);
|
@@ -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
|
-
|
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/dist/tag/dynamic-tag.js
CHANGED
@@ -18,8 +18,15 @@ function _default(path) {
|
|
18
18
|
tagProperties.push(
|
19
19
|
_compiler.types.objectProperty(
|
20
20
|
_compiler.types.identifier("pa"),
|
21
|
-
_compiler.types.
|
22
|
-
node.preserveAttrs.map((name) =>
|
21
|
+
_compiler.types.objectExpression(
|
22
|
+
node.preserveAttrs.map((name) =>
|
23
|
+
_compiler.types.objectProperty(
|
24
|
+
_compiler.types.isValidIdentifier(name) ?
|
25
|
+
_compiler.types.identifier(name) :
|
26
|
+
_compiler.types.stringLiteral(name),
|
27
|
+
_compiler.types.numericLiteral(1)
|
28
|
+
)
|
29
|
+
)
|
23
30
|
)
|
24
31
|
)
|
25
32
|
);
|
@@ -75,8 +75,15 @@ function _default(path, isNullable) {
|
|
75
75
|
tagProperties.push(
|
76
76
|
_compiler.types.objectProperty(
|
77
77
|
_compiler.types.identifier("pa"),
|
78
|
-
_compiler.types.
|
79
|
-
node.preserveAttrs.map((name) =>
|
78
|
+
_compiler.types.objectExpression(
|
79
|
+
node.preserveAttrs.map((name) =>
|
80
|
+
_compiler.types.objectProperty(
|
81
|
+
_compiler.types.isValidIdentifier(name) ?
|
82
|
+
_compiler.types.identifier(name) :
|
83
|
+
_compiler.types.stringLiteral(name),
|
84
|
+
_compiler.types.numericLiteral(1)
|
85
|
+
)
|
86
|
+
)
|
80
87
|
)
|
81
88
|
)
|
82
89
|
);
|
@@ -116,8 +116,15 @@ function tagArguments(path) {
|
|
116
116
|
tagProperties.push(
|
117
117
|
_compiler.types.objectProperty(
|
118
118
|
_compiler.types.identifier("pa"),
|
119
|
-
_compiler.types.
|
120
|
-
node.preserveAttrs.map((name) =>
|
119
|
+
_compiler.types.objectExpression(
|
120
|
+
node.preserveAttrs.map((name) =>
|
121
|
+
_compiler.types.objectProperty(
|
122
|
+
_compiler.types.isValidIdentifier(name) ?
|
123
|
+
_compiler.types.identifier(name) :
|
124
|
+
_compiler.types.stringLiteral(name),
|
125
|
+
_compiler.types.numericLiteral(1)
|
126
|
+
)
|
127
|
+
)
|
121
128
|
)
|
122
129
|
)
|
123
130
|
);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@marko/translator-default",
|
3
|
-
"version": "5.31.
|
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.
|
38
|
+
"marko": "^5.32.12"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
41
|
"@marko/compiler": "^5.16.1",
|