marko 5.39.46 → 5.39.48
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/runtime/helpers/load-tag.js +19 -16
- package/dist/runtime/html/helpers/_dynamic-attr.js +4 -16
- package/dist/translator/util/load-import.js +1 -1
- package/package.json +4 -4
- package/src/runtime/helpers/load-tag.js +20 -17
- package/src/runtime/html/helpers/_dynamic-attr.js +3 -15
- package/src/translator/util/load-import.js +1 -1
|
@@ -68,29 +68,32 @@ runtimeId)
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// Its importer passes the bundler's resolver, so it resolves on a page of either
|
|
71
|
-
// API, whichever page entry rendered.
|
|
71
|
+
// API, whichever page entry rendered. Only its tag renders it, reading the template
|
|
72
|
+
// as it renders: an import cycle may not have evaluated that module yet.
|
|
72
73
|
exports.withLoadAssets = function withLoadAssets(
|
|
73
74
|
typeId,
|
|
74
|
-
|
|
75
|
+
getTemplate,
|
|
75
76
|
assetFlush,
|
|
76
77
|
triggers)
|
|
77
78
|
{
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
return {
|
|
80
|
+
_: function (input, out) {
|
|
81
|
+
var key = out.ad_;
|
|
82
|
+
var def = out.ac_;
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
if (willRerender(def)) {
|
|
85
|
+
out.bf(key + "s", def.s_, true);
|
|
86
|
+
writeLoadAsset(out, typeId, assetFlush, triggers);
|
|
87
|
+
out.ef();
|
|
88
|
+
out.bf(key, def.s_, true);
|
|
89
|
+
getTemplate()._(input, out);
|
|
90
|
+
out.ef();
|
|
91
|
+
} else {
|
|
92
|
+
writeLoadAsset(out, typeId, assetFlush, triggers);
|
|
93
|
+
getTemplate()._(input, out);
|
|
94
|
+
}
|
|
92
95
|
}
|
|
93
|
-
}
|
|
96
|
+
};
|
|
94
97
|
};
|
|
95
98
|
|
|
96
99
|
// Within Tags content the Tags writer places it apart from what a `@catch` drops,
|
|
@@ -4,6 +4,8 @@ var notEmptyAttr = attrHelper.bC_;
|
|
|
4
4
|
var isEmptyAttrValue = attrHelper.bD_;
|
|
5
5
|
var classHelper = require("./class-attr");
|
|
6
6
|
var styleHelper = require("./style-attr");
|
|
7
|
+
// Characters that end or break an attribute name in the HTML parser.
|
|
8
|
+
var invalidAttrNameReg = /[\s/>"'=]/;
|
|
7
9
|
|
|
8
10
|
module.exports = function dynamicAttr(name, value) {
|
|
9
11
|
switch (name) {
|
|
@@ -14,22 +16,8 @@ module.exports = function dynamicAttr(name, value) {
|
|
|
14
16
|
case "renderBody":
|
|
15
17
|
return "";
|
|
16
18
|
default:
|
|
17
|
-
return isEmptyAttrValue(value) ||
|
|
19
|
+
return isEmptyAttrValue(value) || invalidAttrNameReg.test(name) ?
|
|
18
20
|
"" :
|
|
19
21
|
notEmptyAttr(name, value);
|
|
20
22
|
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
|
|
24
|
-
// Technically the above includes more invalid characters for attributes.
|
|
25
|
-
// In practice however the only character that does not become an attribute name
|
|
26
|
-
// is when there is a >.
|
|
27
|
-
function isInvalidAttrName(name) {
|
|
28
|
-
for (let i = name.length; i--;) {
|
|
29
|
-
if (name[i] === ">") {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
23
|
+
};
|
|
@@ -143,7 +143,7 @@ function translateLoadTag(path, tagName, relativePath) {
|
|
|
143
143
|
);
|
|
144
144
|
loadArgs = [
|
|
145
145
|
_compiler.types.stringLiteral(childFile.metadata.marko.id),
|
|
146
|
-
_compiler.types.identifier(tagName),
|
|
146
|
+
_compiler.types.arrowFunctionExpression([], _compiler.types.identifier(tagName)),
|
|
147
147
|
(0, _babelUtils.importNamed)(file, linkAssets.runtime, "flush", "marko_asset_flush")];
|
|
148
148
|
|
|
149
149
|
if (triggers) loadArgs.push(_compiler.types.valueToNode(triggers));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "5.39.
|
|
3
|
+
"version": "5.39.48",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"types": "index.d.ts",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@marko/compiler": "^5.42.
|
|
71
|
-
"@marko/runtime-tags": "^6.4.
|
|
70
|
+
"@marko/compiler": "^5.42.14",
|
|
71
|
+
"@marko/runtime-tags": "^6.4.8",
|
|
72
72
|
"app-module-path": "^2.2.0",
|
|
73
73
|
"argly": "^1.2.0",
|
|
74
74
|
"browser-refresh-client": "1.1.4",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"warp10": "^2.1.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"marko": "5.39.
|
|
87
|
+
"marko": "5.39.48"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=22"
|
|
@@ -68,29 +68,32 @@ exports.withPageAssets = function withPageAssets(
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// Its importer passes the bundler's resolver, so it resolves on a page of either
|
|
71
|
-
// API, whichever page entry rendered.
|
|
71
|
+
// API, whichever page entry rendered. Only its tag renders it, reading the template
|
|
72
|
+
// as it renders: an import cycle may not have evaluated that module yet.
|
|
72
73
|
exports.withLoadAssets = function withLoadAssets(
|
|
73
74
|
typeId,
|
|
74
|
-
|
|
75
|
+
getTemplate,
|
|
75
76
|
assetFlush,
|
|
76
77
|
triggers,
|
|
77
78
|
) {
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
return {
|
|
80
|
+
_: function (input, out) {
|
|
81
|
+
var key = out.___assignedKey;
|
|
82
|
+
var def = out.___assignedComponentDef;
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
if (willRerender(def)) {
|
|
85
|
+
out.bf(key + "s", def.___component, true);
|
|
86
|
+
writeLoadAsset(out, typeId, assetFlush, triggers);
|
|
87
|
+
out.ef();
|
|
88
|
+
out.bf(key, def.___component, true);
|
|
89
|
+
getTemplate()._(input, out);
|
|
90
|
+
out.ef();
|
|
91
|
+
} else {
|
|
92
|
+
writeLoadAsset(out, typeId, assetFlush, triggers);
|
|
93
|
+
getTemplate()._(input, out);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
};
|
|
94
97
|
};
|
|
95
98
|
|
|
96
99
|
// Within Tags content the Tags writer places it apart from what a `@catch` drops,
|
|
@@ -4,6 +4,8 @@ var notEmptyAttr = attrHelper.___notEmptyAttr;
|
|
|
4
4
|
var isEmptyAttrValue = attrHelper.___isEmptyAttrValue;
|
|
5
5
|
var classHelper = require("./class-attr");
|
|
6
6
|
var styleHelper = require("./style-attr");
|
|
7
|
+
// Characters that end or break an attribute name in the HTML parser.
|
|
8
|
+
var invalidAttrNameReg = /[\s/>"'=]/;
|
|
7
9
|
|
|
8
10
|
module.exports = function dynamicAttr(name, value) {
|
|
9
11
|
switch (name) {
|
|
@@ -14,22 +16,8 @@ module.exports = function dynamicAttr(name, value) {
|
|
|
14
16
|
case "renderBody":
|
|
15
17
|
return "";
|
|
16
18
|
default:
|
|
17
|
-
return isEmptyAttrValue(value) ||
|
|
19
|
+
return isEmptyAttrValue(value) || invalidAttrNameReg.test(name)
|
|
18
20
|
? ""
|
|
19
21
|
: notEmptyAttr(name, value);
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
|
-
|
|
23
|
-
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
|
|
24
|
-
// Technically the above includes more invalid characters for attributes.
|
|
25
|
-
// In practice however the only character that does not become an attribute name
|
|
26
|
-
// is when there is a >.
|
|
27
|
-
function isInvalidAttrName(name) {
|
|
28
|
-
for (let i = name.length; i--;) {
|
|
29
|
-
if (name[i] === ">") {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
@@ -143,7 +143,7 @@ export function translateLoadTag(path, tagName, relativePath) {
|
|
|
143
143
|
);
|
|
144
144
|
loadArgs = [
|
|
145
145
|
t.stringLiteral(childFile.metadata.marko.id),
|
|
146
|
-
t.identifier(tagName),
|
|
146
|
+
t.arrowFunctionExpression([], t.identifier(tagName)),
|
|
147
147
|
importNamed(file, linkAssets.runtime, "flush", "marko_asset_flush"),
|
|
148
148
|
];
|
|
149
149
|
if (triggers) loadArgs.push(t.valueToNode(triggers));
|