@marko/compiler 5.33.4 → 5.33.6
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.
|
@@ -10,6 +10,8 @@ var _babelUtils = require("@marko/babel-utils");function _getRequireWildcardCach
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
|
|
13
15
|
const noop = () => {};
|
|
14
16
|
const emptyRange = (part) => part.start === part.end;
|
|
15
17
|
const isAttrTag = (tag) => {var _tag$name$value;return ((_tag$name$value = tag.name.value) == null ? void 0 : _tag$name$value[0]) === "@";};
|
|
@@ -197,6 +199,22 @@ function parseMarko(file) {
|
|
|
197
199
|
onComment(part) {
|
|
198
200
|
pushContent(withLoc(t.markoComment(parser.read(part.value)), part));
|
|
199
201
|
},
|
|
202
|
+
onTagTypeArgs(part) {
|
|
203
|
+
currentTag.node.typeArguments = (0, _babelUtils.parseTypeArgs)(
|
|
204
|
+
file,
|
|
205
|
+
parser.read(part.value),
|
|
206
|
+
part.start,
|
|
207
|
+
part.end
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
onTagTypeParams(part) {
|
|
211
|
+
currentTag.node.typeParameters = (0, _babelUtils.parseTypeParams)(
|
|
212
|
+
file,
|
|
213
|
+
parser.read(part.value),
|
|
214
|
+
part.start,
|
|
215
|
+
part.end
|
|
216
|
+
);
|
|
217
|
+
},
|
|
200
218
|
onPlaceholder(part) {
|
|
201
219
|
pushContent(
|
|
202
220
|
withLoc(
|
|
@@ -171,6 +171,12 @@ Object.assign(_printer.default.prototype, {
|
|
|
171
171
|
this.token(tagName);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
if (node.typeArguments) {
|
|
175
|
+
this.token("<");
|
|
176
|
+
this.printList(node.typeArguments.params, node);
|
|
177
|
+
this.token(">");
|
|
178
|
+
}
|
|
179
|
+
|
|
174
180
|
if (node.var) {
|
|
175
181
|
this.token("/");
|
|
176
182
|
this.print(node.var, node);
|
|
@@ -187,6 +193,14 @@ Object.assign(_printer.default.prototype, {
|
|
|
187
193
|
}
|
|
188
194
|
|
|
189
195
|
if (node.body.params.length) {
|
|
196
|
+
if (node.typeParameters) {
|
|
197
|
+
if (!node.typeArguments) {
|
|
198
|
+
this.token(" ");
|
|
199
|
+
}
|
|
200
|
+
this.token("<");
|
|
201
|
+
this.printList(node.typeParameters.params, node);
|
|
202
|
+
this.token(">");
|
|
203
|
+
}
|
|
190
204
|
this.token("|");
|
|
191
205
|
this.printList(node.body.params, node);
|
|
192
206
|
this.token("|");
|
|
@@ -192,6 +192,20 @@ const MarkoDefinitions = {
|
|
|
192
192
|
),
|
|
193
193
|
optional: true
|
|
194
194
|
},
|
|
195
|
+
typeArguments: {
|
|
196
|
+
validate: (0, _utils.chain)(
|
|
197
|
+
(0, _utils.assertValueType)("array"),
|
|
198
|
+
(0, _utils.assertEach)((0, _utils.assertNodeType)("TypeAnnotation"))
|
|
199
|
+
),
|
|
200
|
+
optional: true
|
|
201
|
+
},
|
|
202
|
+
typeParameters: {
|
|
203
|
+
validate: (0, _utils.chain)(
|
|
204
|
+
(0, _utils.assertValueType)("array"),
|
|
205
|
+
(0, _utils.assertEach)((0, _utils.assertNodeType)("TypeAnnotation"))
|
|
206
|
+
),
|
|
207
|
+
optional: true
|
|
208
|
+
},
|
|
195
209
|
rawValue: {
|
|
196
210
|
validate: (0, _utils.assertValueType)("string"),
|
|
197
211
|
optional: true
|
package/dist/types.d.ts
CHANGED
|
@@ -1730,6 +1730,8 @@ export interface MarkoTag extends BaseNode {
|
|
|
1730
1730
|
arguments: Array<Expression | SpreadElement> | null;
|
|
1731
1731
|
var: LVal | null;
|
|
1732
1732
|
rawValue: string | null;
|
|
1733
|
+
typeArguments: Array<TypeAnnotation> | null;
|
|
1734
|
+
typeParameters: Array<TypeAnnotation> | null;
|
|
1733
1735
|
}
|
|
1734
1736
|
|
|
1735
1737
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/compiler",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.6",
|
|
4
4
|
"description": "Marko template to JS compiler.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"babel",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/runtime": "^7.16.0",
|
|
46
46
|
"@babel/traverse": "^7.16.0",
|
|
47
47
|
"@babel/types": "^7.16.0",
|
|
48
|
-
"@marko/babel-utils": "^6.3.
|
|
48
|
+
"@marko/babel-utils": "^6.3.3",
|
|
49
49
|
"complain": "^1.6.0",
|
|
50
50
|
"he": "^1.2.0",
|
|
51
51
|
"htmljs-parser": "^5.4.3",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"strip-json-comments": "^3.1.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@marko/translator-default": "^5.31.
|
|
64
|
+
"@marko/translator-default": "^5.31.6"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|