marko 5.21.2 → 5.21.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.
- package/README.md +6 -6
- package/bin/markoc.js +13 -1
- package/dist/core-tags/core/await/reorderer-renderer.js +26 -6
- package/dist/runtime/RenderResult.js +7 -7
- package/dist/runtime/components/Component.js +129 -129
- package/dist/runtime/components/ComponentDef.js +25 -25
- package/dist/runtime/components/ComponentsContext.js +8 -8
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +25 -25
- package/dist/runtime/components/attach-detach.js +8 -8
- package/dist/runtime/components/beginComponent/index-browser.js +2 -2
- package/dist/runtime/components/beginComponent/index.js +7 -7
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +3 -3
- package/dist/runtime/components/endComponent/index.js +2 -2
- package/dist/runtime/components/entry/index-browser.js +4 -4
- package/dist/runtime/components/entry/index.js +15 -15
- package/dist/runtime/components/event-delegation.js +10 -10
- package/dist/runtime/components/init-components/index-browser.js +34 -34
- package/dist/runtime/components/registry/index-browser.js +7 -7
- package/dist/runtime/components/registry/index.js +2 -2
- package/dist/runtime/components/renderer.js +26 -26
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/components/util/index-browser.js +17 -17
- package/dist/runtime/components/util/index.js +9 -9
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +5 -5
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/dynamic-tag.js +7 -7
- package/dist/runtime/helpers/style-value.js +1 -1
- package/dist/runtime/html/AsyncStream.js +20 -20
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/StringWriter.js +1 -1
- package/dist/runtime/html/helpers/attr.js +1 -1
- package/dist/runtime/html/helpers/data-marko.js +4 -4
- package/dist/runtime/html/helpers/escape-quotes.js +1 -1
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +1 -1
- package/dist/runtime/renderable.js +4 -4
- package/dist/runtime/setImmediate/index-browser.js +1 -1
- package/dist/runtime/setImmediate/index-worker.js +2 -2
- package/dist/runtime/setImmediate/index.js +2 -2
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +28 -28
- package/dist/runtime/vdom/VDocumentFragment.js +1 -1
- package/dist/runtime/vdom/VElement.js +11 -11
- package/dist/runtime/vdom/VFragment.js +3 -3
- package/dist/runtime/vdom/VNode.js +4 -4
- package/dist/runtime/vdom/hot-reload.js +15 -15
- package/dist/runtime/vdom/index.js +1 -1
- package/dist/runtime/vdom/morphdom/fragment.js +2 -2
- package/dist/runtime/vdom/morphdom/helpers.js +4 -4
- package/dist/runtime/vdom/morphdom/index.js +28 -28
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +1 -1
- package/docs/10-awesome-marko-features.md +3 -4
- package/docs/class-components.md +5 -5
- package/docs/cloudflare-workers.md +4 -6
- package/docs/compiler.md +13 -2
- package/docs/core-tags.md +9 -1
- package/docs/express.md +2 -2
- package/docs/http.md +2 -2
- package/docs/koa.md +2 -2
- package/docs/marko-5-upgrade.md +3 -4
- package/docs/marko-vs-react.md +7 -7
- package/docs/redux.md +6 -6
- package/docs/rendering.md +48 -41
- package/docs/troubleshooting-streaming.md +5 -5
- package/docs/webpack.md +9 -9
- package/package.json +3 -3
- package/src/core-tags/core/await/reorderer-renderer.js +27 -7
- package/docs/server-side-rendering.md +0 -144
package/README.md
CHANGED
@@ -39,7 +39,7 @@ number of times the button has been clicked.
|
|
39
39
|
```marko
|
40
40
|
class {
|
41
41
|
onCreate() {
|
42
|
-
this.state = { count:0 };
|
42
|
+
this.state = { count: 0 };
|
43
43
|
}
|
44
44
|
increment() {
|
45
45
|
this.state.count++;
|
@@ -48,12 +48,12 @@ class {
|
|
48
48
|
|
49
49
|
style {
|
50
50
|
.count {
|
51
|
-
color
|
52
|
-
font-size:3em;
|
51
|
+
color: #09c;
|
52
|
+
font-size: 3em;
|
53
53
|
}
|
54
54
|
.example-button {
|
55
|
-
font-size:1em;
|
56
|
-
padding:0.5em;
|
55
|
+
font-size: 1em;
|
56
|
+
padding: 0.5em;
|
57
57
|
}
|
58
58
|
}
|
59
59
|
|
@@ -85,7 +85,7 @@ component style:
|
|
85
85
|
**component.js**
|
86
86
|
|
87
87
|
```js
|
88
|
-
|
88
|
+
export default {
|
89
89
|
onCreate() {
|
90
90
|
this.state = { count: 0 };
|
91
91
|
},
|
package/bin/markoc.js
CHANGED
@@ -65,6 +65,15 @@ var args = require("argly")
|
|
65
65
|
type: "boolean",
|
66
66
|
description: "Only print warnings and errors"
|
67
67
|
},
|
68
|
+
"--migrate -m": {
|
69
|
+
type: "boolean",
|
70
|
+
description:
|
71
|
+
"Run any migrations that exist for the provided template and write changes to disk"
|
72
|
+
},
|
73
|
+
"--strip-types -t": {
|
74
|
+
type: "boolean",
|
75
|
+
description: "Strip all type information from the compiled template"
|
76
|
+
},
|
68
77
|
"--browser -b": {
|
69
78
|
type: "boolean",
|
70
79
|
description: "Browser output"
|
@@ -123,12 +132,15 @@ var isForBrowser = false;
|
|
123
132
|
if (args.browser) {
|
124
133
|
output = "dom";
|
125
134
|
isForBrowser = true;
|
135
|
+
} else if (args.migrate) {
|
136
|
+
output = "migrate";
|
126
137
|
}
|
127
138
|
|
128
139
|
var compileOptions = {
|
129
140
|
output: output,
|
130
141
|
browser: isForBrowser,
|
131
142
|
sourceOnly: false,
|
143
|
+
stripTypes: args.stripTypes,
|
132
144
|
sourceMaps: args.sourceMaps || false,
|
133
145
|
compilerType: "markoc",
|
134
146
|
compilerVersion: markoPkgVersion || markocPkgVersion
|
@@ -325,7 +337,7 @@ if (args.clean) {
|
|
325
337
|
}
|
326
338
|
|
327
339
|
found[path] = true;
|
328
|
-
var outPath = path + ".js";
|
340
|
+
var outPath = args.migrate ? path : path + ".js";
|
329
341
|
|
330
342
|
if (!args.quiet)
|
331
343
|
console.log(
|
@@ -1,5 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var escapeDoubleQuotes =
|
4
|
+
require("../../../runtime/html/helpers/escape-quotes").y_;
|
5
|
+
|
3
6
|
module.exports = function (input, out) {
|
4
7
|
// We cannot call beginSync() when using renderSync(). In this case we will
|
5
8
|
// ignore the await-reorderer tag.
|
@@ -54,13 +57,30 @@ module.exports = function (input, out) {
|
|
54
57
|
global._afRuntime = true;
|
55
58
|
}
|
56
59
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
if (global.cspNonce) {
|
61
|
+
asyncOut.write(
|
62
|
+
'<style nonce="' +
|
63
|
+
escapeDoubleQuotes(global.cspNonce) +
|
64
|
+
'">' +
|
65
|
+
"#af" +
|
66
|
+
awaitInfo.id +
|
67
|
+
"{display:none;}" +
|
68
|
+
"</style>" +
|
69
|
+
'<div id="af' +
|
70
|
+
awaitInfo.id +
|
71
|
+
'">' +
|
72
|
+
result.toString() +
|
73
|
+
"</div>");
|
74
|
+
|
75
|
+
} else {
|
76
|
+
asyncOut.write(
|
77
|
+
'<div id="af' +
|
78
|
+
awaitInfo.id +
|
79
|
+
'" style="display:none">' +
|
80
|
+
result.toString() +
|
81
|
+
"</div>");
|
63
82
|
|
83
|
+
}
|
64
84
|
|
65
85
|
asyncOut.script(
|
66
86
|
"$af(" + (
|
@@ -17,7 +17,7 @@ function getComponentDefs(result) {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
function RenderResult(out) {
|
20
|
-
this.out = this.
|
20
|
+
this.out = this.z_ = out;
|
21
21
|
this.b_ = undefined;
|
22
22
|
}
|
23
23
|
|
@@ -47,10 +47,10 @@ var proto = RenderResult.prototype = {
|
|
47
47
|
},
|
48
48
|
|
49
49
|
afterInsert: function (host) {
|
50
|
-
var out = this.
|
50
|
+
var out = this.z_;
|
51
51
|
var componentsContext = out.b_;
|
52
52
|
if (componentsContext) {
|
53
|
-
this.b_ = componentsContext.
|
53
|
+
this.b_ = componentsContext.A_(host);
|
54
54
|
} else {
|
55
55
|
this.b_ = null;
|
56
56
|
}
|
@@ -58,13 +58,13 @@ var proto = RenderResult.prototype = {
|
|
58
58
|
return this;
|
59
59
|
},
|
60
60
|
getNode: function (host) {
|
61
|
-
return this.
|
61
|
+
return this.z_.B_(host);
|
62
62
|
},
|
63
63
|
getOutput: function () {
|
64
|
-
return this.
|
64
|
+
return this.z_.C_();
|
65
65
|
},
|
66
66
|
toString: function () {
|
67
|
-
return this.
|
67
|
+
return this.z_.toString();
|
68
68
|
},
|
69
69
|
document: typeof document === "object" && document };
|
70
70
|
|
@@ -89,7 +89,7 @@ Object.defineProperty(proto, "context", {
|
|
89
89
|
|
90
90
|
|
91
91
|
|
92
|
-
return this.
|
92
|
+
return this.z_;
|
93
93
|
} });
|
94
94
|
|
95
95
|
|