@marko/translator-default 5.31.0 → 5.31.2
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/dist/cdata/index[html].js +5 -5
- package/dist/cdata/index[vdom].js +2 -2
- package/dist/class.js +21 -21
- package/dist/comment/index[html].js +2 -2
- package/dist/declaration/index[html].js +2 -2
- package/dist/document-type/index[html].js +2 -2
- package/dist/index.js +165 -165
- package/dist/placeholder/index[html].js +17 -17
- package/dist/placeholder/index[vdom].js +5 -5
- package/dist/tag/attribute/directives/class.js +12 -12
- package/dist/tag/attribute/directives/no-update.js +8 -8
- package/dist/tag/attribute/directives/style.js +12 -12
- package/dist/tag/attribute/index.js +15 -15
- package/dist/tag/attribute/modifiers/scoped.js +11 -11
- package/dist/tag/attribute-tag.js +67 -67
- package/dist/tag/custom-tag.js +37 -37
- package/dist/tag/dynamic-tag.js +29 -29
- package/dist/tag/index.js +9 -9
- package/dist/tag/native-tag[html]/attributes.js +41 -41
- package/dist/tag/native-tag[html]/index.js +67 -67
- package/dist/tag/native-tag[vdom]/attributes.js +34 -34
- package/dist/tag/native-tag[vdom]/index.js +59 -59
- package/dist/tag/util.js +42 -42
- package/dist/taglib/core/conditional/translate-else-if.js +2 -2
- package/dist/taglib/core/conditional/translate-else.js +2 -2
- package/dist/taglib/core/conditional/util.js +5 -5
- package/dist/taglib/core/macro/translate.js +9 -9
- package/dist/taglib/core/parse-class.js +2 -2
- package/dist/taglib/core/transform-style.js +6 -6
- package/dist/taglib/core/translate-await.js +11 -11
- package/dist/taglib/core/translate-body.js +5 -5
- package/dist/taglib/core/translate-for.js +65 -65
- package/dist/taglib/core/translate-include-content.js +9 -9
- package/dist/taglib/core/translate-while.js +10 -10
- package/dist/taglib/migrate/all-templates.js +8 -8
- package/dist/text/index[html].js +2 -2
- package/dist/text/index[vdom].js +9 -9
- package/dist/util/add-dependencies.js +38 -38
- package/dist/util/get-component-files.js +2 -2
- package/dist/util/html-out-write.js +5 -5
- package/dist/util/key-manager.js +27 -27
- package/dist/util/optimize-vdom-create.js +31 -31
- package/dist/util/vdom-out-write.js +5 -5
- package/package.json +3 -3
package/dist/tag/util.js
CHANGED
|
@@ -37,11 +37,11 @@ function getAttrs(path, preserveNames, skipRenderBody) {
|
|
|
37
37
|
|
|
38
38
|
if (!targetObject) {
|
|
39
39
|
properties.push(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
_compiler.types.objectProperty(
|
|
41
|
+
_compiler.types.stringLiteral(key),
|
|
42
|
+
targetObject = targetObjects[key] = _compiler.types.objectExpression([])
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
targetProperties = targetObject.properties;
|
|
@@ -62,8 +62,8 @@ function getAttrs(path, preserveNames, skipRenderBody) {
|
|
|
62
62
|
|
|
63
63
|
foundProperties[targetProperty] = true;
|
|
64
64
|
targetProperties.push(
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
_compiler.types.objectProperty(_compiler.types.stringLiteral(targetProperty), value)
|
|
66
|
+
);
|
|
67
67
|
} else {
|
|
68
68
|
mergeSpread(properties, value);
|
|
69
69
|
}
|
|
@@ -74,9 +74,9 @@ function getAttrs(path, preserveNames, skipRenderBody) {
|
|
|
74
74
|
|
|
75
75
|
if (hasDynamicAttrTags) {
|
|
76
76
|
endDynamicAttrTagsIndex = findLastIndex(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
body,
|
|
78
|
+
({ value }) => value === "END_ATTRIBUTE_TAGS"
|
|
79
|
+
);
|
|
80
80
|
path.
|
|
81
81
|
insertBefore(body.slice(0, endDynamicAttrTagsIndex)).
|
|
82
82
|
map((child) => child.skip());
|
|
@@ -84,18 +84,18 @@ function getAttrs(path, preserveNames, skipRenderBody) {
|
|
|
84
84
|
|
|
85
85
|
if (!hasDynamicAttrTags || endDynamicAttrTagsIndex !== childLen - 1) {
|
|
86
86
|
properties.push(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
_compiler.types.objectProperty(
|
|
88
|
+
_compiler.types.stringLiteral("renderBody"),
|
|
89
|
+
_compiler.types.arrowFunctionExpression(
|
|
90
|
+
[_compiler.types.identifier("out"), ...params],
|
|
91
|
+
_compiler.types.blockStatement(
|
|
92
|
+
hasDynamicAttrTags ?
|
|
93
|
+
body.slice(endDynamicAttrTagsIndex + 1) :
|
|
94
|
+
body
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -109,11 +109,11 @@ function getAttrs(path, preserveNames, skipRenderBody) {
|
|
|
109
109
|
|
|
110
110
|
if (attr.defaultValue !== undefined) {
|
|
111
111
|
properties.push(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
_compiler.types.objectProperty(
|
|
113
|
+
_compiler.types.stringLiteral(attr.name),
|
|
114
|
+
_compiler.types.stringLiteral(attr.defaultValue + "")
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
117
|
} else if (attr.required) {
|
|
118
118
|
throw path.
|
|
119
119
|
get("name").
|
|
@@ -140,20 +140,20 @@ function buildEventHandlerArray(path) {
|
|
|
140
140
|
|
|
141
141
|
return [
|
|
142
142
|
_compiler.types.arrayExpression(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
Object.entries(handlers).map(([eventName, { arguments: args, once }]) => {
|
|
144
|
+
const parts = [
|
|
145
|
+
_compiler.types.stringLiteral(eventName),
|
|
146
|
+
args[0],
|
|
147
|
+
_compiler.types.booleanLiteral(once)];
|
|
149
148
|
|
|
150
|
-
if (args.length > 1) {
|
|
151
|
-
parts.push(_compiler.types.arrayExpression(args.slice(1)));
|
|
152
|
-
}
|
|
153
149
|
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
if (args.length > 1) {
|
|
151
|
+
parts.push(_compiler.types.arrayExpression(args.slice(1)));
|
|
152
|
+
}
|
|
156
153
|
|
|
154
|
+
return _compiler.types.arrayExpression(parts);
|
|
155
|
+
})
|
|
156
|
+
)];
|
|
157
157
|
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -172,8 +172,8 @@ function evaluateAttr(attr) {var _classToString, _styleToString;
|
|
|
172
172
|
replace(/\s+/, " ").
|
|
173
173
|
trim().
|
|
174
174
|
replace(/;$/, "")
|
|
175
|
-
};
|
|
176
|
-
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
177
|
|
|
178
178
|
if (value == null || value === false) {
|
|
179
179
|
return { value: undefined };
|
|
@@ -189,8 +189,8 @@ function evaluateAttr(attr) {var _classToString, _styleToString;
|
|
|
189
189
|
case Array.prototype.toString:
|
|
190
190
|
return { value: JSON.stringify(value) };
|
|
191
191
|
case RegExp.prototype.toString:
|
|
192
|
-
return { value: value.source };
|
|
193
|
-
|
|
192
|
+
return { value: value.source };
|
|
193
|
+
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
return { value: value + "" };
|
|
@@ -10,8 +10,8 @@ function exit(path) {
|
|
|
10
10
|
throw path.
|
|
11
11
|
get("name").
|
|
12
12
|
buildCodeFrameError(
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
"Invalid 'else-if' tag, expected preceding 'if' or 'else-if' tag."
|
|
14
|
+
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
ifStatement.alternate = (0, _util.buildIfStatement)(path, args);
|
|
@@ -14,8 +14,8 @@ function exit(path) {
|
|
|
14
14
|
throw path.
|
|
15
15
|
get("name").
|
|
16
16
|
buildCodeFrameError(
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
"Invalid 'else' tag, expected preceding 'if' or 'else-if' tag."
|
|
18
|
+
);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
ifStatement.alternate = _compiler.types.blockStatement(body);
|
|
@@ -5,14 +5,14 @@ function buildIfStatement(path, args) {
|
|
|
5
5
|
if (!args || !args.length) {
|
|
6
6
|
const name = path.get("name");
|
|
7
7
|
throw name.buildCodeFrameError(
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
`Invalid '<${name.node.value}>' tag, expected arguments like '<${name.node.value}(test)>'.`
|
|
9
|
+
);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const ifStatement = _compiler.types.ifStatement(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
args.length === 1 ? args[0] : _compiler.types.sequenceExpression(args),
|
|
14
|
+
_compiler.types.blockStatement(path.node.body.body)
|
|
15
|
+
);
|
|
16
16
|
|
|
17
17
|
let nextPath = path.getNextSibling();
|
|
18
18
|
|
|
@@ -32,13 +32,13 @@ function exit(path) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
path.replaceWith(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
(0, _withPreviousLocation.default)(
|
|
36
|
+
_compiler.types.functionDeclaration(
|
|
37
|
+
(0, _babelUtils.getMacroIdentifierForName)(path, nameAttr.value.value),
|
|
38
|
+
[_compiler.types.identifier("out"), ...body.params],
|
|
39
|
+
_compiler.types.blockStatement(body.body)
|
|
40
|
+
),
|
|
41
|
+
node
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
44
|
}
|
|
@@ -51,8 +51,8 @@ function _default(path) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const constructorPropIndex = parsed.body.body.findIndex(
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
(prop) => _compiler.types.isClassMethod(prop) && prop.kind === "constructor"
|
|
55
|
+
);
|
|
56
56
|
if (constructorPropIndex !== -1) {
|
|
57
57
|
const constructorProp = parsed.body.body[constructorPropIndex];
|
|
58
58
|
(0, _babelUtils.diagnosticError)(path, {
|
|
@@ -16,24 +16,24 @@ function _default(tag) {
|
|
|
16
16
|
throw tag.
|
|
17
17
|
get("name").
|
|
18
18
|
buildCodeFrameError(
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
"Style blocks must be at the root of your Marko template."
|
|
20
|
+
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (deps.some((dep) => dep.style)) {
|
|
24
24
|
throw tag.
|
|
25
25
|
get("name").
|
|
26
26
|
buildCodeFrameError(
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
"A Marko file can only contain a single inline style block."
|
|
28
|
+
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if ((0, _getComponentFiles.default)(tag).styleFile) {
|
|
32
32
|
throw tag.
|
|
33
33
|
get("name").
|
|
34
34
|
buildCodeFrameError(
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
'A Marko file can either have an inline style block, or an external "style.ext" file, but not both.'
|
|
36
|
+
);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const [startContent, type = ".css"] = matchedBlock;
|
|
@@ -7,8 +7,8 @@ function enter(path) {
|
|
|
7
7
|
throw path.
|
|
8
8
|
get("name").
|
|
9
9
|
buildCodeFrameError(
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
'You must provide a promise argument to the "<await>" tag, eg: "<await(promise)>".'
|
|
11
|
+
);
|
|
12
12
|
} else if (args.length > 1) {
|
|
13
13
|
const {
|
|
14
14
|
loc: { start }
|
|
@@ -17,24 +17,24 @@ function enter(path) {
|
|
|
17
17
|
loc: { end }
|
|
18
18
|
} = args[args.length - 1].node;
|
|
19
19
|
throw path.hub.file.buildCodeFrameError(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
{ loc: { start, end } },
|
|
21
|
+
'You can only pass one argument to the "<await>" tag.'
|
|
22
|
+
);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const [provider] = args;
|
|
26
26
|
path.pushContainer(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
"attributes",
|
|
28
|
+
_compiler.types.markoAttribute("_provider", provider.node)
|
|
29
|
+
);
|
|
30
30
|
|
|
31
31
|
if (
|
|
32
32
|
!path.get("attributes").some((attr) => attr.get("name").node === "name"))
|
|
33
33
|
{
|
|
34
34
|
path.pushContainer(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
"attributes",
|
|
36
|
+
_compiler.types.markoAttribute("_name", _compiler.types.stringLiteral(provider.toString()))
|
|
37
|
+
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
path.set("arguments", undefined);
|
|
@@ -8,10 +8,10 @@ function enter(path) {
|
|
|
8
8
|
_compiler.types.markoTag(_compiler.types.stringLiteral("init-components"), [], _compiler.types.markoTagBody()),
|
|
9
9
|
_compiler.types.markoTag(_compiler.types.stringLiteral("await-reorderer"), [], _compiler.types.markoTagBody()),
|
|
10
10
|
_compiler.types.markoTag(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
_compiler.types.stringLiteral("_preferred-script-location"),
|
|
12
|
+
[],
|
|
13
|
+
_compiler.types.markoTagBody()
|
|
14
|
+
)]
|
|
15
|
+
);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -23,40 +23,40 @@ function exit(path) {
|
|
|
23
23
|
|
|
24
24
|
if (!keyParam) {
|
|
25
25
|
throw namePath.buildCodeFrameError(
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
"Invalid 'for in' tag, missing |key, value| params."
|
|
27
|
+
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (valParam) {
|
|
31
31
|
block.body.unshift(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
_compiler.types.variableDeclaration("const", [
|
|
33
|
+
_compiler.types.variableDeclarator(
|
|
34
|
+
valParam,
|
|
35
|
+
_compiler.types.memberExpression(inAttr.value, keyParam, true)
|
|
36
|
+
)]
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
forNode = _compiler.types.forInStatement(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
_compiler.types.variableDeclaration("const", [_compiler.types.variableDeclarator(keyParam)]),
|
|
43
|
+
inAttr.value,
|
|
44
|
+
block
|
|
45
|
+
);
|
|
46
46
|
} else if (ofAttr) {
|
|
47
47
|
let ofAttrValue = _compiler.types.logicalExpression(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
"||",
|
|
49
|
+
ofAttr.value,
|
|
50
|
+
_compiler.types.arrayExpression([])
|
|
51
|
+
);
|
|
52
52
|
allowedAttributes.push("of");
|
|
53
53
|
|
|
54
54
|
const [valParam, keyParam, loopParam] = params;
|
|
55
55
|
|
|
56
56
|
if (!valParam) {
|
|
57
57
|
throw namePath.buildCodeFrameError(
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
"Invalid 'for of' tag, missing |value, index| params."
|
|
59
|
+
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
forNode = [];
|
|
@@ -64,34 +64,34 @@ function exit(path) {
|
|
|
64
64
|
if (keyParam) {
|
|
65
65
|
const indexName = path.scope.generateUidIdentifier(keyParam.name);
|
|
66
66
|
forNode.push(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
_compiler.types.variableDeclaration("let", [
|
|
68
|
+
_compiler.types.variableDeclarator(indexName, _compiler.types.numericLiteral(0))]
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
71
|
|
|
72
72
|
block.body.unshift(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
_compiler.types.variableDeclaration("let", [
|
|
74
|
+
_compiler.types.variableDeclarator(keyParam, _compiler.types.updateExpression("++", indexName))]
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
if (loopParam) {
|
|
80
80
|
ofAttrValue = loopParam;
|
|
81
81
|
forNode.push(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
_compiler.types.variableDeclaration("const", [
|
|
83
|
+
_compiler.types.variableDeclarator(loopParam, ofAttr.value)]
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
forNode.push(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
_compiler.types.forOfStatement(
|
|
90
|
+
_compiler.types.variableDeclaration("const", [_compiler.types.variableDeclarator(valParam)]),
|
|
91
|
+
ofAttrValue,
|
|
92
|
+
block
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
95
|
} else if (fromAttr && toAttr) {
|
|
96
96
|
allowedAttributes.push("from", "to", "step");
|
|
97
97
|
|
|
@@ -105,39 +105,39 @@ function exit(path) {
|
|
|
105
105
|
|
|
106
106
|
if (indexParam) {
|
|
107
107
|
block.body.unshift(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
_compiler.types.variableDeclaration("const", [
|
|
109
|
+
_compiler.types.variableDeclarator(
|
|
110
|
+
indexParam,
|
|
111
|
+
_compiler.types.binaryExpression(
|
|
112
|
+
"+",
|
|
113
|
+
fromAttr.value,
|
|
114
|
+
_compiler.types.binaryExpression("*", stepName, stepValue)
|
|
115
|
+
)
|
|
116
|
+
)]
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
forNode = _compiler.types.forStatement(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
122
|
+
_compiler.types.variableDeclaration("let", [
|
|
123
|
+
_compiler.types.variableDeclarator(
|
|
124
|
+
stepsName,
|
|
125
|
+
_compiler.types.binaryExpression(
|
|
126
|
+
"/",
|
|
127
|
+
_compiler.types.binaryExpression("-", toAttr.value, fromAttr.value),
|
|
128
|
+
stepValue
|
|
129
|
+
)
|
|
130
|
+
),
|
|
131
|
+
_compiler.types.variableDeclarator(stepName, _compiler.types.numericLiteral(0))]
|
|
132
|
+
),
|
|
133
|
+
_compiler.types.binaryExpression("<=", stepName, stepsName),
|
|
134
|
+
_compiler.types.updateExpression("++", stepName),
|
|
135
|
+
block
|
|
136
|
+
);
|
|
137
137
|
} else {
|
|
138
138
|
throw namePath.buildCodeFrameError(
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
"Invalid 'for' tag, missing an 'of', 'in' or 'to' attribute."
|
|
140
|
+
);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
(0, _babelUtils.assertAllowedAttributes)(path, allowedAttributes);
|
|
@@ -16,16 +16,16 @@ function enter(tag) {
|
|
|
16
16
|
|
|
17
17
|
if (args.length !== 1) {
|
|
18
18
|
throw tag.buildCodeFrameError(
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
`A single path argument is required for ${tagExample}.`
|
|
20
|
+
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const [content] = args;
|
|
24
24
|
|
|
25
25
|
if (!content.isStringLiteral()) {
|
|
26
26
|
throw content.buildCodeFrameError(
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
`The argument to ${tagExample} must be a static string.`
|
|
28
|
+
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const dir = _path.default.dirname(file.opts.filename);
|
|
@@ -42,9 +42,9 @@ function enter(tag) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
tag.replaceWith(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
_compiler.types.markoPlaceholder(
|
|
46
|
+
_compiler.types.stringLiteral(fs.readFileSync(fullPath).toString("utf-8")),
|
|
47
|
+
tagName === "include-text"
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
50
|
}
|
|
@@ -15,17 +15,17 @@ function exit(path) {
|
|
|
15
15
|
throw path.
|
|
16
16
|
get("name").
|
|
17
17
|
buildCodeFrameError(
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
"A condition is required for the <while(condition)> tag."
|
|
19
|
+
);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
path.replaceWith(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
(0, _withPreviousLocation.default)(
|
|
24
|
+
_compiler.types.whileStatement(
|
|
25
|
+
(0, _babelUtils.getArgOrSequence)(path),
|
|
26
|
+
_compiler.types.blockStatement(path.node.body.body)
|
|
27
|
+
),
|
|
28
|
+
path.node
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
31
|
}
|
|
@@ -18,12 +18,12 @@ const kHadAssignment = Symbol();var _default =
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
root.insertBefore(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
_compiler.types.markoScriptlet([
|
|
22
|
+
_compiler.types.variableDeclaration("var", [
|
|
23
|
+
_compiler.types.variableDeclarator(_compiler.types.identifier("data"))]
|
|
24
|
+
)]
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
ReferencedIdentifier(path, state) {
|
|
@@ -36,8 +36,8 @@ const kHadAssignment = Symbol();var _default =
|
|
|
36
36
|
label: "The 'data' variable is deprecated. Use 'input' instead.",
|
|
37
37
|
fix() {
|
|
38
38
|
path.replaceWith(
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
(0, _withPreviousLocation.default)(_compiler.types.identifier("input"), path.node)
|
|
40
|
+
);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
}
|
package/dist/text/index[html].js
CHANGED
|
@@ -6,6 +6,6 @@ function _default(path) {
|
|
|
6
6
|
const { node } = path;
|
|
7
7
|
|
|
8
8
|
path.replaceWith(
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
(0, _withPreviousLocation.default)((0, _htmlOutWrite.default)`${_compiler.types.stringLiteral(node.value)}`, node)
|
|
10
|
+
);
|
|
11
11
|
}
|
package/dist/text/index[vdom].js
CHANGED
|
@@ -7,13 +7,13 @@ function _default(path) {
|
|
|
7
7
|
const { node } = path;
|
|
8
8
|
|
|
9
9
|
path.replaceWith(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
(0, _withPreviousLocation.default)(
|
|
11
|
+
(0, _vdomOutWrite.default)(
|
|
12
|
+
"t",
|
|
13
|
+
_compiler.types.stringLiteral((0, _he.decode)(node.value)),
|
|
14
|
+
path.hub.file._componentInstanceIdentifier
|
|
15
|
+
),
|
|
16
|
+
node
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
19
|
}
|