marko 5.31.0 → 5.31.2
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 +10 -10
- package/dist/core-tags/components/preserve-tag.js +1 -81
- package/dist/core-tags/core/await/AsyncValue.js +25 -25
- package/dist/core-tags/core/await/renderer.js +11 -11
- package/dist/core-tags/core/await/reorderer-renderer.js +31 -31
- package/dist/node-require/hot-reload.js +5 -5
- package/dist/node-require/index.js +8 -8
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +8 -8
- package/dist/node_modules/@internal/components-beginComponent/index.js +25 -25
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +53 -51
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +3 -3
- package/dist/node_modules/@internal/components-endComponent/index.js +3 -3
- package/dist/node_modules/@internal/components-entry/index-browser.js +3 -2
- package/dist/node_modules/@internal/components-entry/index.js +24 -24
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +10 -9
- package/dist/node_modules/@internal/components-entry-legacy/index.js +2 -1
- package/dist/node_modules/@internal/components-registry/index-browser.js +84 -92
- package/dist/node_modules/@internal/components-registry/index.js +2 -2
- package/dist/node_modules/@internal/components-util/index-browser.js +23 -23
- package/dist/node_modules/@internal/components-util/index.js +10 -10
- package/dist/node_modules/@internal/create-readable/index-browser.js +5 -5
- package/dist/node_modules/@internal/create-readable/index.js +13 -13
- package/dist/node_modules/@internal/loader/fallback-node.js +89 -0
- package/dist/node_modules/@internal/loader/index-browser.js +1 -3
- package/dist/node_modules/@internal/loader/index.js +20 -85
- package/dist/node_modules/@internal/loader/package.json +2 -3
- package/dist/node_modules/@internal/preserve-tag/index-browser.js +45 -0
- package/dist/node_modules/@internal/preserve-tag/index.js +34 -0
- package/dist/node_modules/@internal/preserve-tag/package.json +11 -0
- package/dist/node_modules/@internal/require/index-browser.js +13 -0
- package/dist/node_modules/@internal/require/index-legacy-browser.js +20 -0
- package/dist/node_modules/@internal/require/index-webpack.js +11 -0
- package/dist/node_modules/@internal/require/index.js +15 -0
- package/dist/node_modules/@internal/require/package.json +11 -0
- package/dist/runtime/RenderResult.js +15 -14
- package/dist/runtime/components/Component.js +106 -106
- package/dist/runtime/components/ComponentDef.js +19 -19
- package/dist/runtime/components/ComponentsContext.js +14 -14
- package/dist/runtime/components/GlobalComponentsContext.js +2 -2
- package/dist/runtime/components/ServerComponent.js +12 -12
- package/dist/runtime/components/State.js +19 -19
- package/dist/runtime/components/attach-detach.js +1 -1
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +5 -5
- package/dist/runtime/components/event-delegation.js +55 -55
- package/dist/runtime/components/legacy/defineComponent-legacy.js +1 -6
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +16 -21
- package/dist/runtime/components/legacy/dependencies/index.js +7 -7
- package/dist/runtime/components/legacy/renderer-legacy.js +82 -82
- package/dist/runtime/components/renderer.js +44 -44
- package/dist/runtime/dom-insert.js +2 -2
- package/dist/runtime/helpers/_change-case.js +3 -3
- package/dist/runtime/helpers/class-value.js +2 -2
- package/dist/runtime/helpers/dynamic-tag.js +35 -35
- package/dist/runtime/helpers/render-tag.js +4 -4
- package/dist/runtime/html/AsyncStream.js +16 -16
- package/dist/runtime/html/BufferedWriter.js +14 -14
- package/dist/runtime/html/StringWriter.js +1 -1
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +6 -6
- package/dist/runtime/html/helpers/attrs.js +2 -2
- package/dist/runtime/html/helpers/data-marko.js +6 -6
- package/dist/runtime/html/helpers/escape-quotes.js +1 -1
- package/dist/runtime/html/helpers/escape-xml.js +2 -2
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +10 -10
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +61 -61
- package/dist/runtime/vdom/VComponent.js +2 -2
- package/dist/runtime/vdom/VDocumentFragment.js +1 -1
- package/dist/runtime/vdom/VElement.js +38 -38
- package/dist/runtime/vdom/VFragment.js +4 -4
- package/dist/runtime/vdom/VNode.js +2 -2
- package/dist/runtime/vdom/hot-reload.js +11 -11
- package/dist/runtime/vdom/index.js +9 -9
- package/dist/runtime/vdom/morphdom/fragment.js +9 -9
- package/dist/runtime/vdom/morphdom/helpers.js +7 -7
- package/dist/runtime/vdom/morphdom/index.js +126 -126
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +11 -11
- package/dist/runtime/vdom/vdom.js +2 -2
- package/dist/taglib/index.js +3 -3
- package/package.json +1 -1
- package/src/core-tags/components/preserve-tag.js +1 -81
- package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +17 -15
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +1 -1
- package/src/node_modules/@internal/components-entry/index-browser.js +2 -1
- package/src/node_modules/@internal/components-entry/index.js +2 -2
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +4 -3
- package/src/node_modules/@internal/components-entry-legacy/index.js +2 -1
- package/src/node_modules/@internal/components-registry/index-browser.js +9 -17
- package/src/node_modules/@internal/create-readable/index-browser.js +2 -2
- package/src/node_modules/@internal/loader/fallback-node.js +89 -0
- package/src/node_modules/@internal/loader/index-browser.js +1 -3
- package/src/node_modules/@internal/loader/index.js +21 -86
- package/src/node_modules/@internal/loader/package.json +2 -3
- package/src/node_modules/@internal/preserve-tag/index-browser.js +45 -0
- package/src/node_modules/@internal/preserve-tag/index.js +34 -0
- package/src/node_modules/@internal/preserve-tag/package.json +11 -0
- package/src/node_modules/@internal/require/index-browser.js +13 -0
- package/src/node_modules/@internal/require/index-legacy-browser.js +20 -0
- package/src/node_modules/@internal/require/index-webpack.js +11 -0
- package/src/node_modules/@internal/require/index.js +15 -0
- package/src/node_modules/@internal/require/package.json +11 -0
- package/src/runtime/components/legacy/defineComponent-legacy.js +0 -5
- package/src/runtime/components/legacy/defineRenderer-legacy.js +3 -8
package/dist/compiler/index.js
CHANGED
|
@@ -66,9 +66,9 @@ function _compile(src, filename, userConfig, callback) {
|
|
|
66
66
|
|
|
67
67
|
if (callback) {
|
|
68
68
|
compiler.compile(src, filename, options).then(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
(result) => callback(null, resultCompat(result, options)),
|
|
70
|
+
(error) => callback(error)
|
|
71
|
+
);
|
|
72
72
|
} else {
|
|
73
73
|
return resultCompat(compiler.compileSync(src, filename, options), options);
|
|
74
74
|
}
|
|
@@ -93,13 +93,13 @@ function compileForBrowser(src, filename, options, callback) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
options = extend(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
{
|
|
97
|
+
output: "dom",
|
|
98
|
+
meta: false,
|
|
99
|
+
sourceOnly: false
|
|
100
|
+
},
|
|
101
|
+
options
|
|
102
|
+
);
|
|
103
103
|
|
|
104
104
|
return compile(src, filename, options, callback);
|
|
105
105
|
}
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var getComponentsContext = ComponentsContext.e_;
|
|
3
|
-
|
|
4
|
-
module.exports = function render(input, out) {
|
|
5
|
-
var isComponent = !input.n;
|
|
6
|
-
var shouldPreserve = !("i" in input) || input.i;
|
|
7
|
-
var componentsContext = out.b_;
|
|
8
|
-
|
|
9
|
-
if (typeof document === "object") {
|
|
10
|
-
var isHydrate =
|
|
11
|
-
componentsContext && componentsContext.f_.g_;
|
|
12
|
-
var ownerComponent = out.h_.i_;
|
|
13
|
-
var referenceComponent = ownerComponent;
|
|
14
|
-
var key = out.j_;
|
|
15
|
-
var checkKey = key;
|
|
16
|
-
|
|
17
|
-
if (key[0] !== "@") {
|
|
18
|
-
var parentComponent = componentsContext.k_.i_;
|
|
19
|
-
if (ownerComponent !== parentComponent) {
|
|
20
|
-
referenceComponent = parentComponent;
|
|
21
|
-
checkKey += ":" + ownerComponent.id;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var isPreserved =
|
|
26
|
-
shouldPreserve && (
|
|
27
|
-
isHydrate || referenceComponent.l_[checkKey]);
|
|
28
|
-
|
|
29
|
-
if (isComponent) {
|
|
30
|
-
out.bf(key, ownerComponent, shouldPreserve);
|
|
31
|
-
|
|
32
|
-
if (!isPreserved && input.renderBody) {
|
|
33
|
-
input.renderBody(out);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
out.ef();
|
|
37
|
-
} else {
|
|
38
|
-
if (isPreserved) {
|
|
39
|
-
if (input.b) {
|
|
40
|
-
out.m_.n_ = true;
|
|
41
|
-
} else {
|
|
42
|
-
out.beginElement("", null, key, ownerComponent);
|
|
43
|
-
out.m_.o_ = true;
|
|
44
|
-
out.endElement();
|
|
45
|
-
}
|
|
46
|
-
} else if (input.renderBody) {
|
|
47
|
-
input.renderBody(out);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
if (isComponent) {
|
|
52
|
-
out.bf(
|
|
53
|
-
out.j_,
|
|
54
|
-
out.h_.i_,
|
|
55
|
-
true);
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (input.renderBody) {
|
|
60
|
-
if (shouldPreserve) {
|
|
61
|
-
var parentPreserved = false;
|
|
62
|
-
|
|
63
|
-
if (componentsContext) {
|
|
64
|
-
parentPreserved = componentsContext.p_;
|
|
65
|
-
} else {
|
|
66
|
-
componentsContext = getComponentsContext(out);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
componentsContext.p_ = true;
|
|
70
|
-
input.renderBody(out);
|
|
71
|
-
componentsContext.p_ = parentPreserved;
|
|
72
|
-
} else {
|
|
73
|
-
input.renderBody(out);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (isComponent) {
|
|
78
|
-
out.ef();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
1
|
+
"use strict";module.exports = require("@internal/preserve-tag");
|
|
@@ -5,30 +5,30 @@ function AsyncValue() {
|
|
|
5
5
|
* The data that was provided via call to resolve(data).
|
|
6
6
|
* This property is assumed to be public and available for inspection.
|
|
7
7
|
*/
|
|
8
|
-
this.
|
|
8
|
+
this.e_ = undefined;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The data that was provided via call to reject(err)
|
|
12
12
|
* This property is assumed to be public and available for inspection.
|
|
13
13
|
*/
|
|
14
|
-
this.
|
|
14
|
+
this.f_ = undefined;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The queue of callbacks that are waiting for data
|
|
18
18
|
*/
|
|
19
|
-
this.
|
|
19
|
+
this.g_ = undefined;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The state of the data holder (STATE_INITIAL, STATE_RESOLVED, or STATE_REJECTED)
|
|
23
23
|
*/
|
|
24
|
-
this.
|
|
24
|
+
this.h_ = false;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function notifyCallbacks(asyncValue, err, value) {
|
|
28
|
-
var callbacks = asyncValue.
|
|
28
|
+
var callbacks = asyncValue.g_;
|
|
29
29
|
if (callbacks) {
|
|
30
30
|
// clear out the registered callbacks (we still have reference to the original value)
|
|
31
|
-
asyncValue.
|
|
31
|
+
asyncValue.g_ = undefined;
|
|
32
32
|
|
|
33
33
|
// invoke all of the callbacks and use their scope
|
|
34
34
|
for (var i = 0; i < callbacks.length; i++) {
|
|
@@ -46,14 +46,14 @@ AsyncValue.prototype = {
|
|
|
46
46
|
* The given callback will be invoked when there is an error or resolved data
|
|
47
47
|
* available.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
i_: function (callback) {
|
|
50
50
|
// Do we already have data or error?
|
|
51
|
-
if (this.
|
|
51
|
+
if (this.h_) {
|
|
52
52
|
// invoke the callback immediately
|
|
53
|
-
return callback(this.
|
|
53
|
+
return callback(this.f_, this.e_);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
var callbacks = this.
|
|
56
|
+
var callbacks = this.g_ || (this.g_ = []);
|
|
57
57
|
callbacks.push(callback);
|
|
58
58
|
},
|
|
59
59
|
|
|
@@ -63,19 +63,19 @@ AsyncValue.prototype = {
|
|
|
63
63
|
* its initial state so that any future requests to load data will trigger a
|
|
64
64
|
* new load call.
|
|
65
65
|
*/
|
|
66
|
-
|
|
67
|
-
if (this.
|
|
66
|
+
j_: function (err) {
|
|
67
|
+
if (this.h_) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// remember the error
|
|
72
|
-
this.
|
|
72
|
+
this.f_ = err;
|
|
73
73
|
|
|
74
74
|
// Go to the rejected state if we don't have a loader.
|
|
75
75
|
// If we do have a loader then return to the initial state
|
|
76
76
|
// (we do this so that next call to done() will trigger load
|
|
77
77
|
// again in case the error was transient).
|
|
78
|
-
this.
|
|
78
|
+
this.h_ = true;
|
|
79
79
|
|
|
80
80
|
// always notify callbacks regardless of whether or not we return to the initial state
|
|
81
81
|
notifyCallbacks(this, err, null);
|
|
@@ -84,8 +84,8 @@ AsyncValue.prototype = {
|
|
|
84
84
|
/**
|
|
85
85
|
* This method will trigger any callbacks to be notified of data.
|
|
86
86
|
*/
|
|
87
|
-
|
|
88
|
-
if (this.
|
|
87
|
+
k_: function (value) {
|
|
88
|
+
if (this.h_) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -93,23 +93,23 @@ AsyncValue.prototype = {
|
|
|
93
93
|
var asyncValue = this;
|
|
94
94
|
|
|
95
95
|
var finalPromise = value.then(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
function onFulfilled(value) {
|
|
97
|
+
queueMicrotask(asyncValue.k_.bind(asyncValue, value));
|
|
98
|
+
},
|
|
99
|
+
function onRejected(err) {
|
|
100
|
+
queueMicrotask(asyncValue.j_.bind(asyncValue, err));
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
103
|
|
|
104
104
|
if (finalPromise.done) {
|
|
105
105
|
finalPromise.done();
|
|
106
106
|
}
|
|
107
107
|
} else {
|
|
108
108
|
// remember the state
|
|
109
|
-
this.
|
|
109
|
+
this.e_ = value;
|
|
110
110
|
|
|
111
111
|
// go to the resolved state
|
|
112
|
-
this.
|
|
112
|
+
this.h_ = true;
|
|
113
113
|
|
|
114
114
|
// notify callbacks
|
|
115
115
|
notifyCallbacks(this, null, value);
|
|
@@ -24,9 +24,9 @@ function requestData(provider, timeout) {
|
|
|
24
24
|
|
|
25
25
|
var callback = function (err, data) {
|
|
26
26
|
if (err) {
|
|
27
|
-
asyncValue.
|
|
27
|
+
asyncValue.j_(err);
|
|
28
28
|
} else {
|
|
29
|
-
asyncValue.
|
|
29
|
+
asyncValue.k_(data);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -38,11 +38,11 @@ function requestData(provider, timeout) {
|
|
|
38
38
|
provider(null, callback);
|
|
39
39
|
|
|
40
40
|
if (value !== undefined) {
|
|
41
|
-
asyncValue.
|
|
41
|
+
asyncValue.k_(value);
|
|
42
42
|
}
|
|
43
43
|
} else {
|
|
44
44
|
// Assume the provider is a data object...
|
|
45
|
-
asyncValue.
|
|
45
|
+
asyncValue.k_(provider);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (timeout == null) {
|
|
@@ -64,10 +64,10 @@ function requestData(provider, timeout) {
|
|
|
64
64
|
if (!error) error = new Error(errorMsg);
|
|
65
65
|
error.code = "ERR_AWAIT_TIMEDOUT";
|
|
66
66
|
error.name = "TimeoutError";
|
|
67
|
-
asyncValue.
|
|
67
|
+
asyncValue.j_(error);
|
|
68
68
|
}, timeout);
|
|
69
69
|
|
|
70
|
-
asyncValue.
|
|
70
|
+
asyncValue.i_(function () {
|
|
71
71
|
if (timeoutId != null) {
|
|
72
72
|
clearTimeout(timeoutId);
|
|
73
73
|
}
|
|
@@ -91,8 +91,8 @@ module.exports = function awaitTag(input, out) {
|
|
|
91
91
|
var asyncValue = requestData(provider, timeout);
|
|
92
92
|
var placeholderRenderer = input.placeholder && input.placeholder.renderBody;
|
|
93
93
|
|
|
94
|
-
if (asyncValue.
|
|
95
|
-
renderContents(asyncValue.
|
|
94
|
+
if (asyncValue.h_) {
|
|
95
|
+
renderContents(asyncValue.f_, asyncValue.e_, input, out);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -109,8 +109,8 @@ module.exports = function awaitTag(input, out) {
|
|
|
109
109
|
awaitInfo.after = input.showAfter;
|
|
110
110
|
|
|
111
111
|
clientReorderContext =
|
|
112
|
-
out.global.
|
|
113
|
-
out.global.
|
|
112
|
+
out.global.l_ || (
|
|
113
|
+
out.global.l_ = {
|
|
114
114
|
instances: [],
|
|
115
115
|
nextId: 0
|
|
116
116
|
});
|
|
@@ -210,7 +210,7 @@ module.exports = function awaitTag(input, out) {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
asyncValue.
|
|
213
|
+
asyncValue.i_(renderBody);
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
function renderContents(err, data, input, out) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var escapeDoubleQuotes =
|
|
4
|
-
require("../../../runtime/html/helpers/escape-quotes").
|
|
4
|
+
require("../../../runtime/html/helpers/escape-quotes").m_;
|
|
5
5
|
|
|
6
6
|
module.exports = function (input, out) {
|
|
7
7
|
// We cannot call beginSync() when using renderSync(). In this case we will
|
|
@@ -20,7 +20,7 @@ module.exports = function (input, out) {
|
|
|
20
20
|
|
|
21
21
|
global.__awaitReordererInvoked = true;
|
|
22
22
|
|
|
23
|
-
if (out.global.
|
|
23
|
+
if (out.global.l_) {
|
|
24
24
|
out.flush();
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ module.exports = function (input, out) {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
out.onLast(function (next) {
|
|
34
|
-
var awaitContext = global.
|
|
34
|
+
var awaitContext = global.l_;
|
|
35
35
|
var remaining;
|
|
36
36
|
|
|
37
37
|
// Validate that we have remaining <await> instances that need handled
|
|
@@ -52,44 +52,44 @@ module.exports = function (input, out) {
|
|
|
52
52
|
if (!global._afRuntime) {
|
|
53
53
|
// Minified version of ./client-reorder-runtime.js
|
|
54
54
|
asyncOut.script(
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
`function $af(d,a,e,l,g,h,k,b,f,c){c=$af;if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("af"+d);g=e.getElementById("afph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`
|
|
56
|
+
);
|
|
57
57
|
global._afRuntime = true;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
if (global.cspNonce) {
|
|
61
61
|
asyncOut.write(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
75
|
} else {
|
|
76
76
|
asyncOut.write(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
'<div id="af' +
|
|
78
|
+
awaitInfo.id +
|
|
79
|
+
'" style="display:none">' +
|
|
80
|
+
result.toString() +
|
|
81
|
+
"</div>"
|
|
82
|
+
);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
asyncOut.script(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
"$af(" + (
|
|
87
|
+
typeof awaitInfo.id === "number" ?
|
|
88
|
+
awaitInfo.id :
|
|
89
|
+
'"' + awaitInfo.id + '"') + (
|
|
90
|
+
awaitInfo.after ? ',"' + awaitInfo.after + '"' : "") +
|
|
91
|
+
")"
|
|
92
|
+
);
|
|
93
93
|
|
|
94
94
|
awaitInfo.out.writer = asyncOut.writer;
|
|
95
95
|
|
|
@@ -8,9 +8,9 @@ require("../runtime/html/hot-reload");
|
|
|
8
8
|
exports.handleFileModified = function (filename) {
|
|
9
9
|
if (!fs.existsSync(filename)) {
|
|
10
10
|
console.log(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"[marko/hot-reload] WARNING cannot resolve template path: ",
|
|
12
|
+
filename
|
|
13
|
+
);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -35,8 +35,8 @@ function tryReload(filename) {
|
|
|
35
35
|
delete require.cache[filename];
|
|
36
36
|
require(filename);
|
|
37
37
|
console.log(
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
`[marko] Template successfully reloaded: ${cwdRelative(filename)}`
|
|
39
|
+
);
|
|
40
40
|
} catch (e) {
|
|
41
41
|
console.error(e);
|
|
42
42
|
}
|
|
@@ -27,14 +27,14 @@ function normalizeExtension(extension) {
|
|
|
27
27
|
|
|
28
28
|
function compile(templatePath, markoCompiler, userCompilerOptions) {
|
|
29
29
|
return markoCompiler.compileFileSync(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
code;
|
|
30
|
+
templatePath,
|
|
31
|
+
Object.assign(
|
|
32
|
+
{},
|
|
33
|
+
defaultCompilerOptions,
|
|
34
|
+
userCompilerOptions,
|
|
35
|
+
requiredCompilerOptions
|
|
36
|
+
)
|
|
37
|
+
).code;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function install(options) {
|
|
@@ -7,17 +7,17 @@ key,
|
|
|
7
7
|
ownerComponentDef)
|
|
8
8
|
{
|
|
9
9
|
var componentId = component.id;
|
|
10
|
-
var componentDef = componentsContext.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
componentsContext.
|
|
10
|
+
var componentDef = componentsContext.n_ = new ComponentDef(
|
|
11
|
+
component,
|
|
12
|
+
componentId,
|
|
13
|
+
componentsContext
|
|
14
|
+
);
|
|
15
|
+
componentsContext.o_.p_[
|
|
16
16
|
componentId] =
|
|
17
17
|
true;
|
|
18
18
|
componentsContext.b_.push(componentDef);
|
|
19
19
|
|
|
20
|
-
var out = componentsContext.
|
|
21
|
-
out.bc(component, key, ownerComponentDef && ownerComponentDef.
|
|
20
|
+
var out = componentsContext.q_;
|
|
21
|
+
out.bc(component, key, ownerComponentDef && ownerComponentDef.r_);
|
|
22
22
|
return componentDef;
|
|
23
23
|
};
|
|
@@ -21,20 +21,20 @@ existingComponentDef)
|
|
|
21
21
|
// widget. It should be removed when the legacy compat layer is removed.
|
|
22
22
|
var componentDef =
|
|
23
23
|
existingComponentDef || (
|
|
24
|
-
componentsContext.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
componentsContext.n_ = new ComponentDef(
|
|
25
|
+
component,
|
|
26
|
+
componentId,
|
|
27
|
+
componentsContext
|
|
28
|
+
));
|
|
29
29
|
|
|
30
30
|
var ownerIsRenderBoundary =
|
|
31
|
-
ownerComponentDef && ownerComponentDef.
|
|
31
|
+
ownerComponentDef && ownerComponentDef.s_;
|
|
32
32
|
var ownerWillRerender =
|
|
33
33
|
ownerComponentDef &&
|
|
34
|
-
ownerComponentDef.
|
|
34
|
+
ownerComponentDef.t_ & FLAG_WILL_RERENDER_IN_BROWSER;
|
|
35
35
|
// On the server
|
|
36
|
-
if (!componentsContext.
|
|
37
|
-
componentDef.
|
|
36
|
+
if (!componentsContext.u_ && ownerWillRerender) {
|
|
37
|
+
componentDef.t_ |= FLAG_WILL_RERENDER_IN_BROWSER;
|
|
38
38
|
componentDef._wrr = true;
|
|
39
39
|
return componentDef;
|
|
40
40
|
}
|
|
@@ -48,34 +48,34 @@ existingComponentDef)
|
|
|
48
48
|
|
|
49
49
|
componentsContext.b_.push(componentDef);
|
|
50
50
|
|
|
51
|
-
let out = componentsContext.
|
|
51
|
+
let out = componentsContext.q_;
|
|
52
52
|
let runtimeId = out.global.runtimeId;
|
|
53
53
|
|
|
54
|
-
componentDef.
|
|
55
|
-
componentDef.
|
|
54
|
+
componentDef.s_ = true;
|
|
55
|
+
componentDef.v_ = componentsContext.u_;
|
|
56
56
|
|
|
57
57
|
if (isSplitComponent === false && out.global.noBrowserRerender !== true) {
|
|
58
|
-
componentDef.
|
|
58
|
+
componentDef.t_ |= FLAG_WILL_RERENDER_IN_BROWSER;
|
|
59
59
|
componentDef._wrr = true;
|
|
60
|
-
componentsContext.
|
|
60
|
+
componentsContext.u_ = false;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (out.global.oldHydrateNoCreate === true) {
|
|
64
|
-
componentDef.
|
|
64
|
+
componentDef.t_ |= FLAG_OLD_HYDRATE_NO_CREATE;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {
|
|
68
68
|
out.w(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
"<!--" +
|
|
70
|
+
runtimeId +
|
|
71
|
+
"^" +
|
|
72
|
+
componentId +
|
|
73
|
+
" " +
|
|
74
|
+
ownerComponentDef.id +
|
|
75
|
+
" " +
|
|
76
|
+
key +
|
|
77
|
+
"-->"
|
|
78
|
+
);
|
|
79
79
|
} else {
|
|
80
80
|
out.w("<!--" + runtimeId + "#" + componentId + "-->");
|
|
81
81
|
}
|