@marko/compiler 5.33.4 → 5.33.5
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";exports.__esModule = true;exports.parseMarko = parseMarko;var _htmljsParser = require("htmljs-parser");
|
|
2
2
|
var t = _interopRequireWildcard(require("../babel-types"));
|
|
3
|
-
var _babelUtils = require("@marko/babel-utils");
|
|
3
|
+
var _babelUtils = require("@marko/babel-utils");
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ var _babelUtils = require("@marko/babel-utils");function _getRequireWildcardCach
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
var _parse = require("@marko/babel-utils/src/parse");function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function (nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
|
|
12
13
|
|
|
13
14
|
const noop = () => {};
|
|
14
15
|
const emptyRange = (part) => part.start === part.end;
|
|
@@ -197,6 +198,22 @@ function parseMarko(file) {
|
|
|
197
198
|
onComment(part) {
|
|
198
199
|
pushContent(withLoc(t.markoComment(parser.read(part.value)), part));
|
|
199
200
|
},
|
|
201
|
+
onTagTypeArgs(part) {
|
|
202
|
+
currentTag.node.typeArguments = (0, _parse.parseTypeArgs)(
|
|
203
|
+
file,
|
|
204
|
+
parser.read(part.value),
|
|
205
|
+
part.start,
|
|
206
|
+
part.end
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
onTagTypeParams(part) {
|
|
210
|
+
currentTag.node.typeParameters = (0, _parse.parseTypeParams)(
|
|
211
|
+
file,
|
|
212
|
+
parser.read(part.value),
|
|
213
|
+
part.start,
|
|
214
|
+
part.end
|
|
215
|
+
);
|
|
216
|
+
},
|
|
200
217
|
onPlaceholder(part) {
|
|
201
218
|
pushContent(
|
|
202
219
|
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.5",
|
|
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.2",
|
|
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.5"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|