marko 5.39.50 → 5.40.0
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/compiler/index.js +0 -2
- package/dist/core-tags/core/await/index.d.marko +17 -0
- package/dist/core-tags/core/script.d.marko +6 -1
- package/dist/runtime/helpers/dynamic-tag.js +11 -4
- package/dist/runtime/helpers/load-tag.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/dom.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/dist/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html.js +3 -1
- package/dist/runtime/helpers/tags-compat/html.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +50 -51
- package/dist/runtime/helpers/tags-compat/runtime-html.js +18 -20
- package/dist/runtime/html/AsyncStream.js +10 -10
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/renderable.js +1 -1
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -65
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +6 -6
- package/dist/runtime/vdom/VElement.js +39 -58
- package/dist/runtime/vdom/VFragment.js +5 -5
- package/dist/runtime/vdom/VNode.js +29 -29
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/const-element.js +3 -3
- package/dist/runtime/vdom/hot-reload.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +3 -3
- package/dist/runtime/vdom/morphdom/helpers.js +1 -1
- package/dist/runtime/vdom/morphdom/index.js +34 -35
- package/dist/runtime/vdom/vdom.js +15 -15
- package/dist/taglib/index.js +3 -6
- package/dist/translator/index.js +8 -23
- package/dist/translator/tag/attribute/index.js +0 -16
- package/dist/translator/tag/attribute-tag.js +4 -11
- package/dist/translator/tag/custom-tag.js +1 -2
- package/dist/translator/tag/native-tag[html]/index.js +1 -13
- package/dist/translator/tag/native-tag[vdom]/index.js +0 -12
- package/dist/translator/tag/util.js +69 -55
- package/dist/translator/taglib/core/index.js +17 -366
- package/dist/translator/util/get-component-files.js +1 -1
- package/dist/translator/util/runtime-flags.js +2 -3
- package/dist/translator.js +4 -2
- package/docs/marko-json.md +3 -6
- package/index.d.ts +3 -8
- package/package.json +4 -4
- package/src/compiler/index.js +0 -2
- package/src/core-tags/core/await/index.d.marko +17 -0
- package/src/core-tags/core/script.d.marko +6 -1
- package/src/runtime/helpers/dynamic-tag.js +10 -3
- package/src/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/src/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/dom.js +1 -1
- package/src/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/src/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html.js +3 -1
- package/src/runtime/helpers/tags-compat/html.mjs +1 -1
- package/src/runtime/helpers/tags-compat/runtime-dom.js +40 -41
- package/src/runtime/helpers/tags-compat/runtime-html.js +14 -16
- package/src/runtime/vdom/VElement.js +10 -29
- package/src/runtime/vdom/morphdom/index.js +0 -1
- package/src/taglib/index.js +3 -6
- package/src/translator/index.js +6 -21
- package/src/translator/tag/attribute/index.js +1 -17
- package/src/translator/tag/attribute-tag.js +4 -11
- package/src/translator/tag/custom-tag.js +1 -2
- package/src/translator/tag/native-tag[html]/index.js +0 -12
- package/src/translator/tag/native-tag[vdom]/index.js +1 -13
- package/src/translator/tag/util.js +69 -55
- package/src/translator/taglib/core/index.js +0 -349
- package/src/translator/util/runtime-flags.js +1 -2
- package/src/translator.js +2 -0
- package/translator/index.d.ts +1 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.default = _default;var
|
|
2
|
-
|
|
3
|
-
var _compiler = require("@marko/compiler");
|
|
1
|
+
"use strict";exports.__esModule = true;exports.default = _default;var _compiler = require("@marko/compiler");
|
|
4
2
|
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
5
3
|
|
|
6
4
|
|
|
@@ -14,8 +12,6 @@ var _keyManager = require("../../util/key-manager");
|
|
|
14
12
|
var _withPreviousLocation = _interopRequireDefault(require("../../util/with-previous-location"));
|
|
15
13
|
var _attributes = _interopRequireDefault(require("./attributes"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
|
|
16
14
|
|
|
17
|
-
const EMPTY_OBJECT = {};
|
|
18
|
-
|
|
19
15
|
/**
|
|
20
16
|
* Translates the html streaming version of a standard html element.
|
|
21
17
|
*/
|
|
@@ -34,14 +30,6 @@ function _default(path, isNullable) {
|
|
|
34
30
|
const tagDef = (0, _babelUtils.getTagDef)(path);
|
|
35
31
|
const meta = file.metadata.marko;
|
|
36
32
|
|
|
37
|
-
if (tagDef) {
|
|
38
|
-
const { parseOptions = EMPTY_OBJECT } = tagDef;
|
|
39
|
-
if (parseOptions.import) {
|
|
40
|
-
// TODO: the taglib should be updated to support this as a top level option.
|
|
41
|
-
file.metadata.marko.deps.push((0, _path.resolve)(tagDef.dir, parseOptions.import));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
33
|
if (handlers) {
|
|
46
34
|
Object.entries(handlers).forEach(
|
|
47
35
|
([eventName, { arguments: args, once }]) => {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";exports.__esModule = true;exports.default = _default;var _compiler = require("@marko/compiler");
|
|
2
2
|
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
4
|
var FLAGS = _interopRequireWildcard(require("../../util/runtime-flags"));
|
|
8
5
|
var _vdomOutWrite = _interopRequireDefault(require("../../util/vdom-out-write"));
|
|
9
6
|
var _withPreviousLocation = _interopRequireDefault(require("../../util/with-previous-location"));
|
|
@@ -186,15 +183,6 @@ function tagArguments(path) {
|
|
|
186
183
|
runtimeFlags |= FLAGS.HAS_SIMPLE_ATTRS;
|
|
187
184
|
}
|
|
188
185
|
|
|
189
|
-
const tagDef = (0, _babelUtils.getTagDef)(path);
|
|
190
|
-
|
|
191
|
-
if (tagDef) {
|
|
192
|
-
const { htmlType } = tagDef;
|
|
193
|
-
if (htmlType === "custom-element") {
|
|
194
|
-
runtimeFlags |= FLAGS.IS_CUSTOM_ELEMENT;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
186
|
writeArgs.push(_compiler.types.numericLiteral(runtimeFlags));
|
|
199
187
|
|
|
200
188
|
if (tagProperties.length) {
|
|
@@ -25,49 +25,34 @@ function getAttrs(path, preserveNames, isAttrTag) {
|
|
|
25
25
|
const foundProperties = {};
|
|
26
26
|
const hasAttributeTags = !!attributeTags.length;
|
|
27
27
|
const isTagsAPI = findRootTag(path)?.node.extra?.featureType === "tags";
|
|
28
|
+
const isTagsAttrTag = isTagsAPI && isAttrTag;
|
|
28
29
|
const renderBodyKey = isTagsAPI ? "content" : "renderBody";
|
|
29
30
|
|
|
30
31
|
for (let i = 0; i < attrsLen; i++) {
|
|
31
32
|
const { name, value } = attributes[i];
|
|
32
33
|
|
|
33
34
|
if (name) {
|
|
34
|
-
const attrDef = tagDef
|
|
35
|
+
const attrDef = getAttrDef(tagDef, name);
|
|
35
36
|
let targetProperties = properties;
|
|
36
|
-
let targetProperty
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
properties.push(
|
|
50
|
-
_compiler.types.objectProperty(
|
|
51
|
-
_compiler.types.stringLiteral(key),
|
|
52
|
-
targetObject = targetObjects[key] = _compiler.types.objectExpression([])
|
|
53
|
-
)
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
targetProperties = targetObject.properties;
|
|
58
|
-
} else {
|
|
59
|
-
targetProperty = key;
|
|
60
|
-
}
|
|
61
|
-
} else if (
|
|
62
|
-
!preserveName && (
|
|
63
|
-
attrDef.preserveName === true || attrDef.removeDashes === false))
|
|
64
|
-
{
|
|
65
|
-
preserveName = true;
|
|
37
|
+
let targetProperty;
|
|
38
|
+
|
|
39
|
+
if (attrDef?.dynamicAttribute && attrDef.targetProperty) {
|
|
40
|
+
const key = attrDef.targetProperty;
|
|
41
|
+
let targetObject = targetObjects[key];
|
|
42
|
+
|
|
43
|
+
if (!targetObject) {
|
|
44
|
+
properties.push(
|
|
45
|
+
_compiler.types.objectProperty(
|
|
46
|
+
_compiler.types.stringLiteral(key),
|
|
47
|
+
targetObject = targetObjects[key] = _compiler.types.objectExpression([])
|
|
48
|
+
)
|
|
49
|
+
);
|
|
66
50
|
}
|
|
67
|
-
}
|
|
68
51
|
|
|
69
|
-
|
|
70
|
-
targetProperty = camelCase(
|
|
52
|
+
targetProperties = targetObject.properties;
|
|
53
|
+
targetProperty = keepsDashes(attrDef) ? name : camelCase(name);
|
|
54
|
+
} else {
|
|
55
|
+
targetProperty = getAttrProperty(attrDef, name, preserveNames);
|
|
71
56
|
}
|
|
72
57
|
|
|
73
58
|
foundProperties[targetProperty] = true;
|
|
@@ -79,7 +64,9 @@ function getAttrs(path, preserveNames, isAttrTag) {
|
|
|
79
64
|
}
|
|
80
65
|
}
|
|
81
66
|
|
|
82
|
-
|
|
67
|
+
// `attr-tag.js` › `i` stores a returned body as `renderBody`, so a Tags
|
|
68
|
+
// attribute tag keeps its body keyed even beside nested attribute tags.
|
|
69
|
+
if (childLen && (!hasAttributeTags || isTagsAttrTag)) {
|
|
83
70
|
properties.push(
|
|
84
71
|
_compiler.types.objectProperty(
|
|
85
72
|
_compiler.types.stringLiteral(renderBodyKey),
|
|
@@ -92,26 +79,22 @@ function getAttrs(path, preserveNames, isAttrTag) {
|
|
|
92
79
|
}
|
|
93
80
|
|
|
94
81
|
// Default parameters
|
|
95
|
-
tagDef
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} else if (attr.required) {
|
|
110
|
-
throw path.
|
|
111
|
-
get("name").
|
|
112
|
-
buildCodeFrameError(`The "${attr.name}" attribute is required.`);
|
|
82
|
+
if (tagDef?.attributes) {
|
|
83
|
+
for (const name in tagDef.attributes) {
|
|
84
|
+
const attr = tagDef.attributes[name];
|
|
85
|
+
if (attr.defaultValue !== undefined && !attr.dynamicAttribute) {
|
|
86
|
+
const property = getAttrProperty(attr, name, preserveNames);
|
|
87
|
+
if (!foundProperties[property]) {
|
|
88
|
+
properties.push(
|
|
89
|
+
_compiler.types.objectProperty(
|
|
90
|
+
_compiler.types.stringLiteral(property),
|
|
91
|
+
_compiler.types.stringLiteral(attr.defaultValue + "")
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
113
96
|
}
|
|
114
|
-
}
|
|
97
|
+
}
|
|
115
98
|
|
|
116
99
|
let attrsObject =
|
|
117
100
|
properties.length === 0 ?
|
|
@@ -126,7 +109,7 @@ function getAttrs(path, preserveNames, isAttrTag) {
|
|
|
126
109
|
if (hasAttributeTags) {
|
|
127
110
|
let attrTagBody = attributeTags;
|
|
128
111
|
|
|
129
|
-
if (body.length) {
|
|
112
|
+
if (body.length && !isTagsAttrTag) {
|
|
130
113
|
attrTagBody = attrTagBody.concat(
|
|
131
114
|
_compiler.types.returnStatement(
|
|
132
115
|
_compiler.types.arrowFunctionExpression(
|
|
@@ -257,4 +240,35 @@ function findRootTag(tag) {
|
|
|
257
240
|
}
|
|
258
241
|
|
|
259
242
|
return cur;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// A declared attribute, else the `*` attribute, else one whose pattern matches.
|
|
246
|
+
function getAttrDef(tagDef, name) {
|
|
247
|
+
if (!tagDef) return;
|
|
248
|
+
const attr =
|
|
249
|
+
tagDef.attributes && (tagDef.attributes[name] || tagDef.attributes["*"]);
|
|
250
|
+
if (attr || !tagDef.patternAttributes) return attr;
|
|
251
|
+
for (const patternAttr of tagDef.patternAttributes) {
|
|
252
|
+
if (patternAttr.pattern.test(name)) return patternAttr;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// The input property an attribute is passed as: camelCased unless its name is
|
|
257
|
+
// kept, and renamed by a declared target property.
|
|
258
|
+
function getAttrProperty(attrDef, name, preserveNames) {
|
|
259
|
+
if (!attrDef) return preserveNames ? name : camelCase(name);
|
|
260
|
+
if (attrDef.targetProperty) {
|
|
261
|
+
return keepsDashes(attrDef) ?
|
|
262
|
+
attrDef.targetProperty :
|
|
263
|
+
camelCase(attrDef.targetProperty);
|
|
264
|
+
}
|
|
265
|
+
return preserveNames ||
|
|
266
|
+
attrDef.preserveName === true ||
|
|
267
|
+
attrDef.removeDashes === false ?
|
|
268
|
+
name :
|
|
269
|
+
camelCase(name);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function keepsDashes(attrDef) {
|
|
273
|
+
return attrDef.preserveName !== false && attrDef.removeDashes !== true;
|
|
260
274
|
}
|
|
@@ -27,34 +27,14 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
27
27
|
"parse-options": {
|
|
28
28
|
statement: true,
|
|
29
29
|
rawOpenTag: true
|
|
30
|
-
}
|
|
31
|
-
autocomplete: [
|
|
32
|
-
{
|
|
33
|
-
displayText: 'import <scope> from "<path>"',
|
|
34
|
-
description:
|
|
35
|
-
"Use to import external modules, follows the same syntax as JavaScript imports.",
|
|
36
|
-
snippet: 'import ${2} from "${1:path}"',
|
|
37
|
-
descriptionMoreURL:
|
|
38
|
-
"https://markojs.com/docs/syntax/#importing-external-files"
|
|
39
|
-
}]
|
|
40
|
-
|
|
30
|
+
}
|
|
41
31
|
},
|
|
42
32
|
"<export>": {
|
|
43
33
|
"node-factory": parseExport,
|
|
44
34
|
"parse-options": {
|
|
45
35
|
statement: true,
|
|
46
36
|
rawOpenTag: true
|
|
47
|
-
}
|
|
48
|
-
autocomplete: [
|
|
49
|
-
{
|
|
50
|
-
displayText: "export <scope>",
|
|
51
|
-
description:
|
|
52
|
-
"Use export additional data with the template, follows the same syntax as JavaScript exports.",
|
|
53
|
-
snippet: "export ${1}",
|
|
54
|
-
descriptionMoreURL:
|
|
55
|
-
"https://markojs.com/docs/syntax/#importing-external-files"
|
|
56
|
-
}]
|
|
57
|
-
|
|
37
|
+
}
|
|
58
38
|
},
|
|
59
39
|
"<client>": {
|
|
60
40
|
"node-factory": parseClient,
|
|
@@ -75,33 +55,14 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
75
55
|
"parse-options": {
|
|
76
56
|
statement: true,
|
|
77
57
|
rawOpenTag: true
|
|
78
|
-
}
|
|
79
|
-
autocomplete: [
|
|
80
|
-
{
|
|
81
|
-
displayText: "class { /** lifecycle methods **/ }",
|
|
82
|
-
snippet: "class {\n\t$0\n}",
|
|
83
|
-
description:
|
|
84
|
-
"A class containing the lifecycle methods, event handlers, and other properties for this component.",
|
|
85
|
-
descriptionMoreURL:
|
|
86
|
-
"https://markojs.com/docs/class-components/#single-file-components"
|
|
87
|
-
}]
|
|
88
|
-
|
|
58
|
+
}
|
|
89
59
|
},
|
|
90
60
|
"<static>": {
|
|
91
61
|
"node-factory": parseStatic,
|
|
92
62
|
"parse-options": {
|
|
93
63
|
statement: true,
|
|
94
64
|
rawOpenTag: true
|
|
95
|
-
}
|
|
96
|
-
autocomplete: [
|
|
97
|
-
{
|
|
98
|
-
displayText: "static <statement>",
|
|
99
|
-
description:
|
|
100
|
-
"A JavaScript statement which is only evaluated once your template is loaded.",
|
|
101
|
-
descriptionMoreURL:
|
|
102
|
-
"https://markojs.com/docs/syntax/#static-javascript"
|
|
103
|
-
}]
|
|
104
|
-
|
|
65
|
+
}
|
|
105
66
|
},
|
|
106
67
|
"<style>": {
|
|
107
68
|
transformer: transformStyle,
|
|
@@ -113,190 +74,46 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
113
74
|
},
|
|
114
75
|
"<macro>": {
|
|
115
76
|
"node-factory": parseMacro,
|
|
116
|
-
"code-generator": translateMacro
|
|
117
|
-
"@name": {
|
|
118
|
-
type: "string",
|
|
119
|
-
autocomplete: [
|
|
120
|
-
{
|
|
121
|
-
description: "The name which can be used as a tag within a template."
|
|
122
|
-
}]
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
autocomplete: [
|
|
126
|
-
{
|
|
127
|
-
displayText: 'macro|<params>| name="<name>"',
|
|
128
|
-
description: "Creates a reusable fragment within the template.",
|
|
129
|
-
snippet: 'macro|${2:param1, param2}| name="${1:name}"',
|
|
130
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#macro"
|
|
131
|
-
}]
|
|
132
|
-
|
|
77
|
+
"code-generator": translateMacro
|
|
133
78
|
},
|
|
134
79
|
"<include-text>": {
|
|
135
|
-
"code-generator": translateIncludeContent
|
|
136
|
-
attributes: {},
|
|
137
|
-
autocomplete: [
|
|
138
|
-
{
|
|
139
|
-
displayText: 'include-text("<path>")',
|
|
140
|
-
description: "Allows you to inline the contents of a text file.",
|
|
141
|
-
snippet: 'include-text(${1:"./foo.txt"})',
|
|
142
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#include-text"
|
|
143
|
-
}]
|
|
144
|
-
|
|
80
|
+
"code-generator": translateIncludeContent
|
|
145
81
|
},
|
|
146
82
|
"<include-html>": {
|
|
147
|
-
"code-generator": translateIncludeContent
|
|
148
|
-
attributes: {},
|
|
149
|
-
autocomplete: [
|
|
150
|
-
{
|
|
151
|
-
displayText: 'include-html("<path>")',
|
|
152
|
-
snippet: 'include-html(${1:"./foo.html"})',
|
|
153
|
-
description: "Allows you to inline the contents of an html file.",
|
|
154
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#include-html"
|
|
155
|
-
}]
|
|
156
|
-
|
|
83
|
+
"code-generator": translateIncludeContent
|
|
157
84
|
},
|
|
158
85
|
"<if>": {
|
|
159
86
|
"parse-options": { controlFlow: true },
|
|
160
|
-
"code-generator": translateIf
|
|
161
|
-
attributes: {},
|
|
162
|
-
autocomplete: [
|
|
163
|
-
{
|
|
164
|
-
snippet: "if(${1:condition})",
|
|
165
|
-
description: "Use to display content only if the condition is meant.",
|
|
166
|
-
descriptionMoreURL:
|
|
167
|
-
"https://markojs.com/docs/core-tags/#if-else-if-else"
|
|
168
|
-
}]
|
|
169
|
-
|
|
87
|
+
"code-generator": translateIf
|
|
170
88
|
},
|
|
171
89
|
"<else-if>": {
|
|
172
90
|
"parse-options": { controlFlow: true },
|
|
173
|
-
"code-generator": translateElseIf
|
|
174
|
-
attributes: {},
|
|
175
|
-
autocomplete: [
|
|
176
|
-
{
|
|
177
|
-
snippet: "else-if(${1:condition})",
|
|
178
|
-
description:
|
|
179
|
-
"Use after an <if> or <else-if> tag to display content if those conditions do not match and this one does.",
|
|
180
|
-
descriptionMoreURL:
|
|
181
|
-
"https://markojs.com/docs/core-tags/#if-else-if-else"
|
|
182
|
-
}]
|
|
183
|
-
|
|
91
|
+
"code-generator": translateElseIf
|
|
184
92
|
},
|
|
185
93
|
"<else>": {
|
|
186
94
|
"parse-options": { controlFlow: true },
|
|
187
|
-
"code-generator": translateElse
|
|
188
|
-
attributes: {},
|
|
189
|
-
autocomplete: [
|
|
190
|
-
{
|
|
191
|
-
description:
|
|
192
|
-
"Use after an <if> or <else-if> tag to display content if those conditions do not match.",
|
|
193
|
-
descriptionMoreURL:
|
|
194
|
-
"https://markojs.com/docs/core-tags/#if-else-if-else"
|
|
195
|
-
}]
|
|
196
|
-
|
|
95
|
+
"code-generator": translateElse
|
|
197
96
|
},
|
|
198
97
|
"<for>": {
|
|
199
98
|
"parse-options": { controlFlow: true },
|
|
200
|
-
"code-generator": translateFor
|
|
201
|
-
"@of": {
|
|
202
|
-
type: "expression",
|
|
203
|
-
autocomplete: [
|
|
204
|
-
{
|
|
205
|
-
description: "Iterates over a list of items."
|
|
206
|
-
}]
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
"@in": {
|
|
210
|
-
type: "expression",
|
|
211
|
-
autocomplete: [
|
|
212
|
-
{
|
|
213
|
-
description: "Iterates over the keys and values of an object."
|
|
214
|
-
}]
|
|
215
|
-
|
|
216
|
-
},
|
|
217
|
-
"@to": {
|
|
218
|
-
type: "number",
|
|
219
|
-
autocomplete: [
|
|
220
|
-
{
|
|
221
|
-
description: "Iterates up to the provided number (inclusive)"
|
|
222
|
-
}]
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
"@from": {
|
|
226
|
-
type: "number",
|
|
227
|
-
autocomplete: [
|
|
228
|
-
{
|
|
229
|
-
description: "Iterates starting from the provided number (inclusive)"
|
|
230
|
-
}]
|
|
231
|
-
|
|
232
|
-
},
|
|
233
|
-
"@step": {
|
|
234
|
-
type: "number",
|
|
235
|
-
autocomplete: [
|
|
236
|
-
{
|
|
237
|
-
description:
|
|
238
|
-
"The amount to increment during each iteration (with from/to)"
|
|
239
|
-
}]
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
autocomplete: [
|
|
243
|
-
{
|
|
244
|
-
snippet: "for|${1:value, index}| of=${3:array}",
|
|
245
|
-
description:
|
|
246
|
-
"Use to iterate over lists, object properties, or between ranges.",
|
|
247
|
-
descriptionMoreURL:
|
|
248
|
-
"https://markojs.com/docs/core-tags/#iterating-over-a-list"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
snippet: "for|${1:name, value}| in=${3:object}",
|
|
252
|
-
descriptionMoreURL:
|
|
253
|
-
"https://markojs.com/docs/core-tags/#iterating-over-an-objects-properties"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
snippet:
|
|
257
|
-
"for|${1:index}| from=${2:number} to=${3:number} step=${4:number}",
|
|
258
|
-
descriptionMoreURL:
|
|
259
|
-
"https://markojs.com/docs/core-tags/#iterating-between-a-range-of-numbers"
|
|
260
|
-
}]
|
|
261
|
-
|
|
99
|
+
"code-generator": translateFor
|
|
262
100
|
},
|
|
263
101
|
"<while>": {
|
|
264
102
|
"parse-options": { controlFlow: true },
|
|
265
|
-
"code-generator": translateWhile
|
|
266
|
-
autocomplete: [
|
|
267
|
-
{
|
|
268
|
-
snippet: "while(${1:condition})",
|
|
269
|
-
description:
|
|
270
|
-
"Renders the content multiple times until the condition is no longer met.",
|
|
271
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#while"
|
|
272
|
-
}]
|
|
273
|
-
|
|
103
|
+
"code-generator": translateWhile
|
|
274
104
|
},
|
|
275
105
|
"<html-comment>": {
|
|
276
106
|
"code-generator": translateHTMLComment,
|
|
277
107
|
"parse-options": {
|
|
278
108
|
text: true
|
|
279
|
-
}
|
|
280
|
-
attributes: {},
|
|
281
|
-
autocomplete: [
|
|
282
|
-
{
|
|
283
|
-
description:
|
|
284
|
-
"Use to create an html comment that is not stripped from the output.",
|
|
285
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#html-comment"
|
|
286
|
-
}]
|
|
287
|
-
|
|
109
|
+
}
|
|
288
110
|
},
|
|
289
111
|
"<_preserve>": {
|
|
290
|
-
renderer: "marko/src/core-tags/components/preserve-tag.js"
|
|
291
|
-
"@n": "boolean",
|
|
292
|
-
"@i": "boolean",
|
|
293
|
-
"@b": "boolean",
|
|
294
|
-
autocomplete: []
|
|
112
|
+
renderer: "marko/src/core-tags/components/preserve-tag.js"
|
|
295
113
|
},
|
|
296
114
|
"<init-components>": {
|
|
297
115
|
"code-generator": translateServerOnly,
|
|
298
|
-
renderer: "marko/src/core-tags/components/init-components-tag.js"
|
|
299
|
-
"@immediate": "boolean"
|
|
116
|
+
renderer: "marko/src/core-tags/components/init-components-tag.js"
|
|
300
117
|
},
|
|
301
118
|
"<_preferred-script-location>": {
|
|
302
119
|
"code-generator": translateServerOnly,
|
|
@@ -305,93 +122,11 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
305
122
|
"<await>": {
|
|
306
123
|
renderer: "marko/src/core-tags/core/await/renderer.js",
|
|
307
124
|
types: "marko/src/core-tags/core/await/index.d.marko",
|
|
308
|
-
"code-generator": translateAwait
|
|
309
|
-
"@_provider": "expression",
|
|
310
|
-
"@_name": "string",
|
|
311
|
-
"@name": {
|
|
312
|
-
type: "string",
|
|
313
|
-
autocomplete: [
|
|
314
|
-
{
|
|
315
|
-
description:
|
|
316
|
-
"Used to improve debugging and also to ensure promise ordering with the show-after attribute.",
|
|
317
|
-
snippet: 'name="${1:name}"'
|
|
318
|
-
}]
|
|
319
|
-
|
|
320
|
-
},
|
|
321
|
-
"@timeout": {
|
|
322
|
-
type: "number",
|
|
323
|
-
autocomplete: [
|
|
324
|
-
{
|
|
325
|
-
description:
|
|
326
|
-
"An optional timeout that when reached will cause the promise to reject with a TimeoutError."
|
|
327
|
-
}]
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
"@client-reorder": {
|
|
331
|
-
type: "boolean",
|
|
332
|
-
autocomplete: [
|
|
333
|
-
{
|
|
334
|
-
description:
|
|
335
|
-
"If set anything after this promise will be sent out immediately, and reordered using JS in the browser."
|
|
336
|
-
}]
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
"@show-after": {
|
|
340
|
-
type: "string",
|
|
341
|
-
autocomplete: [
|
|
342
|
-
{
|
|
343
|
-
description:
|
|
344
|
-
"This attribute will ensure that (with client-reorder) this await tag will always show after another await tag with the provided name."
|
|
345
|
-
}]
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
"@then <then>": {
|
|
349
|
-
autocomplete: [
|
|
350
|
-
{
|
|
351
|
-
displayText: "then|<result>|",
|
|
352
|
-
description: "Executed with the result of the resolved promise.",
|
|
353
|
-
snippet: "then|${1:result}|",
|
|
354
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
355
|
-
}]
|
|
356
|
-
|
|
357
|
-
},
|
|
358
|
-
"@catch <catch>": {
|
|
359
|
-
autocomplete: [
|
|
360
|
-
{
|
|
361
|
-
displayText: "catch|<err>|",
|
|
362
|
-
description: "Executed with the err of the rejected promise.",
|
|
363
|
-
snippet: "catch|${1:err}|",
|
|
364
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
365
|
-
}]
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
"@placeholder <placeholder>": {
|
|
369
|
-
autocomplete: [
|
|
370
|
-
{
|
|
371
|
-
description: "A placeholder to display while the promise is pending.",
|
|
372
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
373
|
-
}]
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
autocomplete: [
|
|
377
|
-
{
|
|
378
|
-
displayText: "await(<promise>)",
|
|
379
|
-
description:
|
|
380
|
-
"Used to render a template asynchronously with the results of a Promise",
|
|
381
|
-
snippet: "await(${1:promise})",
|
|
382
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
383
|
-
}]
|
|
384
|
-
|
|
125
|
+
"code-generator": translateAwait
|
|
385
126
|
},
|
|
386
127
|
"<await-reorderer>": {
|
|
387
128
|
"code-generator": translateServerOnly,
|
|
388
|
-
renderer: "marko/src/core-tags/core/await/reorderer-renderer.js"
|
|
389
|
-
autocomplete: [
|
|
390
|
-
{
|
|
391
|
-
snippet: "await-reorderer",
|
|
392
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
393
|
-
}]
|
|
394
|
-
|
|
129
|
+
renderer: "marko/src/core-tags/core/await/reorderer-renderer.js"
|
|
395
130
|
},
|
|
396
131
|
"<__flush_here_and_after__>": {
|
|
397
132
|
"code-generator": translateServerOnly,
|
|
@@ -405,89 +140,5 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
405
140
|
},
|
|
406
141
|
"<script>": {
|
|
407
142
|
types: "marko/src/core-tags/core/script.d.marko"
|
|
408
|
-
},
|
|
409
|
-
"<*>": {
|
|
410
|
-
"@key": {
|
|
411
|
-
type: "string",
|
|
412
|
-
"preserve-name": true,
|
|
413
|
-
autocomplete: [
|
|
414
|
-
{
|
|
415
|
-
displayText: 'key="<method>"',
|
|
416
|
-
snippet: 'key="${1:method}"',
|
|
417
|
-
descriptionMoreURL: "https://markojs.com/docs/class-components/#key"
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
descriptionMoreURL: "https://markojs.com/docs/class-components/#key"
|
|
421
|
-
}]
|
|
422
|
-
|
|
423
|
-
},
|
|
424
|
-
"@on*": {
|
|
425
|
-
pattern: true,
|
|
426
|
-
type: "statement",
|
|
427
|
-
"allow-expressions": true,
|
|
428
|
-
"preserve-name": true,
|
|
429
|
-
"set-flag": "hasComponentEvents",
|
|
430
|
-
autocomplete: [
|
|
431
|
-
{
|
|
432
|
-
displayText: 'on<event>("<method>")',
|
|
433
|
-
snippet: 'on${1:Click}("handle${2:Button}${1:Click}")',
|
|
434
|
-
descriptionMoreURL:
|
|
435
|
-
"https://markojs.com/docs/components/#attaching-dom-event-listeners"
|
|
436
|
-
}]
|
|
437
|
-
|
|
438
|
-
},
|
|
439
|
-
"@once*": {
|
|
440
|
-
pattern: true,
|
|
441
|
-
type: "statement",
|
|
442
|
-
"allow-expressions": true,
|
|
443
|
-
"preserve-name": true,
|
|
444
|
-
"set-flag": "hasComponentEvents",
|
|
445
|
-
autocomplete: {
|
|
446
|
-
displayText: 'once<event>("<method>")',
|
|
447
|
-
snippet: 'once${1:Click}("handle${2:Button}${1:Click}")',
|
|
448
|
-
descriptionMoreURL:
|
|
449
|
-
"https://markojs.com/docs/components/#attaching-dom-event-listeners"
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
"@no-update": {
|
|
453
|
-
type: "flag",
|
|
454
|
-
"preserve-name": true,
|
|
455
|
-
autocomplete: [
|
|
456
|
-
{
|
|
457
|
-
descriptionMoreURL:
|
|
458
|
-
"https://markojs.com/docs/class-components/#no-update"
|
|
459
|
-
}]
|
|
460
|
-
|
|
461
|
-
},
|
|
462
|
-
"@no-update-body": {
|
|
463
|
-
type: "flag",
|
|
464
|
-
"preserve-name": true,
|
|
465
|
-
autocomplete: [
|
|
466
|
-
{
|
|
467
|
-
descriptionMoreURL:
|
|
468
|
-
"https://markojs.com/docs/class-components/#no-update-body"
|
|
469
|
-
}]
|
|
470
|
-
|
|
471
|
-
},
|
|
472
|
-
"@no-update-if": {
|
|
473
|
-
"preserve-name": true,
|
|
474
|
-
autocomplete: [
|
|
475
|
-
{
|
|
476
|
-
snippet: "no-update-if(${1:condition})",
|
|
477
|
-
descriptionMoreURL:
|
|
478
|
-
"https://markojs.com/docs/class-components/#no-update-if"
|
|
479
|
-
}]
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
"@no-update-body-if": {
|
|
483
|
-
"preserve-name": true,
|
|
484
|
-
autocomplete: [
|
|
485
|
-
{
|
|
486
|
-
snippet: "no-update-body-if(${1:condition})",
|
|
487
|
-
descriptionMoreURL:
|
|
488
|
-
"https://markojs.com/docs/class-components/#no-update-body-if"
|
|
489
|
-
}]
|
|
490
|
-
|
|
491
|
-
}
|
|
492
143
|
}
|
|
493
144
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _escapeRegexp = require("./escape-regexp");function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
|
|
4
4
|
|
|
5
|
-
const COMPONENT_FILES_KEY = "
|
|
5
|
+
const COMPONENT_FILES_KEY = "cA_";
|
|
6
6
|
|
|
7
7
|
function getComponentFiles({ hub: { file } }) {
|
|
8
8
|
const meta = file.metadata.marko;
|