marko 4.28.3 → 4.28.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -94,22 +94,22 @@ function getCachedTemplate(path) {
|
|
94
94
|
function getPreviousTemplate(templatePath, options) {
|
95
95
|
/*
|
96
96
|
The require.cache is search in the following order:
|
97
|
-
1) /path/to/my-template.js
|
98
|
-
2) /path/to/my-template.
|
97
|
+
1) /path/to/my-template.marko.js
|
98
|
+
2) /path/to/my-template.js
|
99
99
|
3) /path/to/my-template.marko
|
100
100
|
*
|
101
101
|
If the template is not found in require.cache and `assumeUpToDate` is true
|
102
102
|
then we will check the disk for the precompiled templates in the following
|
103
103
|
order:
|
104
|
-
1) /path/to/my-template.js
|
105
|
-
2) /path/to/my-template.
|
104
|
+
1) /path/to/my-template.marko.js
|
105
|
+
2) /path/to/my-template.js
|
106
106
|
*/
|
107
107
|
var ext = nodePath.extname(templatePath);
|
108
|
-
var
|
109
|
-
var
|
108
|
+
var targetPrecompiledMarkoJS = templatePath + ".js";
|
109
|
+
var targetPrecompiledJS = templatePath.slice(0, 0 - ext.length) + ".js";
|
110
110
|
|
111
111
|
// Short-circuit loading if the template has already been cached in the Node.js require cache
|
112
|
-
var cachedTemplate = getCachedTemplate(
|
112
|
+
var cachedTemplate = getCachedTemplate(targetPrecompiledMarkoJS) || getCachedTemplate(targetPrecompiledJS) || getCachedTemplate(templatePath);
|
113
113
|
|
114
114
|
if (cachedTemplate) {
|
115
115
|
return cachedTemplate;
|
@@ -119,12 +119,11 @@ function getPreviousTemplate(templatePath, options) {
|
|
119
119
|
templatePath = nodePath.resolve(cwd, templatePath);
|
120
120
|
|
121
121
|
if (options.assumeUpToDate) {
|
122
|
-
if (fs.existsSync(
|
123
|
-
return require(
|
122
|
+
if (fs.existsSync(targetPrecompiledMarkoJS)) {
|
123
|
+
return require(targetPrecompiledMarkoJS);
|
124
124
|
}
|
125
|
-
|
126
|
-
|
127
|
-
return require(targetFileDebug);
|
125
|
+
if (fs.existsSync(targetPrecompiledJS)) {
|
126
|
+
return require(targetPrecompiledJS);
|
128
127
|
}
|
129
128
|
}
|
130
129
|
|
@@ -437,7 +437,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
437
437
|
var curToNodeValue = curToNodeChild.bW_;
|
438
438
|
var curFromNodeValue = curFromNodeChild.nodeValue;
|
439
439
|
if (curFromNodeValue !== curToNodeValue) {
|
440
|
-
if (isHydrate && curFromNodeType === TEXT_NODE && curFromNodeValue.startsWith(curToNodeValue)) {
|
440
|
+
if (isHydrate && toNextSibling && curFromNodeType === TEXT_NODE && toNextSibling.bX_ === TEXT_NODE && curFromNodeValue.startsWith(curToNodeValue) && toNextSibling.bW_.startsWith(curFromNodeValue.slice(curToNodeValue.length))) {
|
441
441
|
// In hydrate mode we can use splitText to more efficiently handle
|
442
442
|
// adjacent text vdom nodes that were merged.
|
443
443
|
fromNextSibling = curFromNodeChild.splitText(curToNodeValue.length);
|
package/package.json
CHANGED
@@ -96,24 +96,24 @@ function getCachedTemplate(path) {
|
|
96
96
|
function getPreviousTemplate(templatePath, options) {
|
97
97
|
/*
|
98
98
|
The require.cache is search in the following order:
|
99
|
-
1) /path/to/my-template.js
|
100
|
-
2) /path/to/my-template.
|
99
|
+
1) /path/to/my-template.marko.js
|
100
|
+
2) /path/to/my-template.js
|
101
101
|
3) /path/to/my-template.marko
|
102
102
|
*
|
103
103
|
If the template is not found in require.cache and `assumeUpToDate` is true
|
104
104
|
then we will check the disk for the precompiled templates in the following
|
105
105
|
order:
|
106
|
-
1) /path/to/my-template.js
|
107
|
-
2) /path/to/my-template.
|
106
|
+
1) /path/to/my-template.marko.js
|
107
|
+
2) /path/to/my-template.js
|
108
108
|
*/
|
109
109
|
var ext = nodePath.extname(templatePath);
|
110
|
-
var
|
111
|
-
var
|
110
|
+
var targetPrecompiledMarkoJS = templatePath + ".js";
|
111
|
+
var targetPrecompiledJS = templatePath.slice(0, 0 - ext.length) + ".js";
|
112
112
|
|
113
113
|
// Short-circuit loading if the template has already been cached in the Node.js require cache
|
114
114
|
var cachedTemplate =
|
115
|
-
getCachedTemplate(
|
116
|
-
getCachedTemplate(
|
115
|
+
getCachedTemplate(targetPrecompiledMarkoJS) ||
|
116
|
+
getCachedTemplate(targetPrecompiledJS) ||
|
117
117
|
getCachedTemplate(templatePath);
|
118
118
|
|
119
119
|
if (cachedTemplate) {
|
@@ -124,12 +124,11 @@ function getPreviousTemplate(templatePath, options) {
|
|
124
124
|
templatePath = nodePath.resolve(cwd, templatePath);
|
125
125
|
|
126
126
|
if (options.assumeUpToDate) {
|
127
|
-
if (fs.existsSync(
|
128
|
-
return require(
|
127
|
+
if (fs.existsSync(targetPrecompiledMarkoJS)) {
|
128
|
+
return require(targetPrecompiledMarkoJS);
|
129
129
|
}
|
130
|
-
|
131
|
-
|
132
|
-
return require(targetFileDebug);
|
130
|
+
if (fs.existsSync(targetPrecompiledJS)) {
|
131
|
+
return require(targetPrecompiledJS);
|
133
132
|
}
|
134
133
|
}
|
135
134
|
|
@@ -292,13 +292,13 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
292
292
|
curFromNodeChild,
|
293
293
|
curVFromNodeChild,
|
294
294
|
curToNodeChild,
|
295
|
-
parentComponent
|
295
|
+
parentComponent
|
296
296
|
);
|
297
297
|
} else {
|
298
298
|
morphChildren(
|
299
299
|
curFromNodeChild,
|
300
300
|
curToNodeChild,
|
301
|
-
parentComponent
|
301
|
+
parentComponent
|
302
302
|
);
|
303
303
|
}
|
304
304
|
} else {
|
@@ -484,10 +484,9 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
484
484
|
morphChildren(
|
485
485
|
matchingFromEl,
|
486
486
|
curToNodeChild,
|
487
|
-
parentComponent
|
487
|
+
parentComponent
|
488
488
|
);
|
489
489
|
}
|
490
|
-
|
491
490
|
} else {
|
492
491
|
insertVirtualNodeBefore(
|
493
492
|
curToNodeChild,
|
@@ -594,13 +593,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
594
593
|
if (curFromNodeValue !== curToNodeValue) {
|
595
594
|
if (
|
596
595
|
isHydrate &&
|
596
|
+
toNextSibling &&
|
597
597
|
curFromNodeType === TEXT_NODE &&
|
598
|
-
|
598
|
+
toNextSibling.___nodeType === TEXT_NODE &&
|
599
|
+
curFromNodeValue.startsWith(curToNodeValue) &&
|
600
|
+
toNextSibling.___nodeValue.startsWith(
|
601
|
+
curFromNodeValue.slice(curToNodeValue.length)
|
602
|
+
)
|
599
603
|
) {
|
600
604
|
// In hydrate mode we can use splitText to more efficiently handle
|
601
605
|
// adjacent text vdom nodes that were merged.
|
602
606
|
fromNextSibling = curFromNodeChild.splitText(
|
603
|
-
curToNodeValue.length
|
607
|
+
curToNodeValue.length
|
604
608
|
);
|
605
609
|
} else {
|
606
610
|
// Simply update nodeValue on the original node to
|