@lightspeed-js/core 0.4.4 → 0.4.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/dist/compile.js +21 -1
- package/dist/index.js +21 -1
- package/dist/ssg.js +29 -2
- package/dist/vite.js +29 -2
- package/package.json +1 -1
package/dist/compile.js
CHANGED
|
@@ -999,7 +999,7 @@ class BindingEvaluator {
|
|
|
999
999
|
}
|
|
1000
1000
|
if (binding.kind === "prop") {
|
|
1001
1001
|
const target = binding.target;
|
|
1002
|
-
if (
|
|
1002
|
+
if (sameValue(target.props[binding.name], value))
|
|
1003
1003
|
return;
|
|
1004
1004
|
target.props[binding.name] = value;
|
|
1005
1005
|
this.onPropChanged(target);
|
|
@@ -1112,6 +1112,26 @@ function setHidden(el, hidden) {
|
|
|
1112
1112
|
else
|
|
1113
1113
|
el.removeAttribute(HIDDEN_ATTR);
|
|
1114
1114
|
}
|
|
1115
|
+
function sameValue(a, b, depth = 0) {
|
|
1116
|
+
if (Object.is(a, b))
|
|
1117
|
+
return true;
|
|
1118
|
+
if (depth > 20 || !isPlain(a) || !isPlain(b))
|
|
1119
|
+
return false;
|
|
1120
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
1121
|
+
return false;
|
|
1122
|
+
const keys = Object.keys(a);
|
|
1123
|
+
if (keys.length !== Object.keys(b).length)
|
|
1124
|
+
return false;
|
|
1125
|
+
return keys.every((key) => Object.prototype.hasOwnProperty.call(b, key) && sameValue(a[key], b[key], depth + 1));
|
|
1126
|
+
}
|
|
1127
|
+
function isPlain(value) {
|
|
1128
|
+
if (value === null || typeof value !== "object")
|
|
1129
|
+
return false;
|
|
1130
|
+
if (Array.isArray(value))
|
|
1131
|
+
return true;
|
|
1132
|
+
const proto = Object.getPrototypeOf(value);
|
|
1133
|
+
return proto === Object.prototype || proto === null;
|
|
1134
|
+
}
|
|
1115
1135
|
// src/runtime/dom/ForBlock.ts
|
|
1116
1136
|
function toIterable(value) {
|
|
1117
1137
|
if (value == null)
|
package/dist/index.js
CHANGED
|
@@ -571,7 +571,7 @@ class BindingEvaluator {
|
|
|
571
571
|
}
|
|
572
572
|
if (binding.kind === "prop") {
|
|
573
573
|
const target = binding.target;
|
|
574
|
-
if (
|
|
574
|
+
if (sameValue(target.props[binding.name], value))
|
|
575
575
|
return;
|
|
576
576
|
target.props[binding.name] = value;
|
|
577
577
|
this.onPropChanged(target);
|
|
@@ -684,6 +684,26 @@ function setHidden(el, hidden) {
|
|
|
684
684
|
else
|
|
685
685
|
el.removeAttribute(HIDDEN_ATTR);
|
|
686
686
|
}
|
|
687
|
+
function sameValue(a, b, depth = 0) {
|
|
688
|
+
if (Object.is(a, b))
|
|
689
|
+
return true;
|
|
690
|
+
if (depth > 20 || !isPlain(a) || !isPlain(b))
|
|
691
|
+
return false;
|
|
692
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
693
|
+
return false;
|
|
694
|
+
const keys = Object.keys(a);
|
|
695
|
+
if (keys.length !== Object.keys(b).length)
|
|
696
|
+
return false;
|
|
697
|
+
return keys.every((key) => Object.prototype.hasOwnProperty.call(b, key) && sameValue(a[key], b[key], depth + 1));
|
|
698
|
+
}
|
|
699
|
+
function isPlain(value) {
|
|
700
|
+
if (value === null || typeof value !== "object")
|
|
701
|
+
return false;
|
|
702
|
+
if (Array.isArray(value))
|
|
703
|
+
return true;
|
|
704
|
+
const proto = Object.getPrototypeOf(value);
|
|
705
|
+
return proto === Object.prototype || proto === null;
|
|
706
|
+
}
|
|
687
707
|
// src/runtime/events/EventBinder.ts
|
|
688
708
|
class EventBinder {
|
|
689
709
|
bind(el, eventType, handlerName, owner, cleanupTarget = owner) {
|
package/dist/ssg.js
CHANGED
|
@@ -590,7 +590,7 @@ class BindingEvaluator {
|
|
|
590
590
|
}
|
|
591
591
|
if (binding.kind === "prop") {
|
|
592
592
|
const target = binding.target;
|
|
593
|
-
if (
|
|
593
|
+
if (sameValue(target.props[binding.name], value))
|
|
594
594
|
return;
|
|
595
595
|
target.props[binding.name] = value;
|
|
596
596
|
this.onPropChanged(target);
|
|
@@ -703,6 +703,26 @@ function setHidden(el, hidden) {
|
|
|
703
703
|
else
|
|
704
704
|
el.removeAttribute(HIDDEN_ATTR);
|
|
705
705
|
}
|
|
706
|
+
function sameValue(a, b, depth = 0) {
|
|
707
|
+
if (Object.is(a, b))
|
|
708
|
+
return true;
|
|
709
|
+
if (depth > 20 || !isPlain(a) || !isPlain(b))
|
|
710
|
+
return false;
|
|
711
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
712
|
+
return false;
|
|
713
|
+
const keys = Object.keys(a);
|
|
714
|
+
if (keys.length !== Object.keys(b).length)
|
|
715
|
+
return false;
|
|
716
|
+
return keys.every((key) => Object.prototype.hasOwnProperty.call(b, key) && sameValue(a[key], b[key], depth + 1));
|
|
717
|
+
}
|
|
718
|
+
function isPlain(value) {
|
|
719
|
+
if (value === null || typeof value !== "object")
|
|
720
|
+
return false;
|
|
721
|
+
if (Array.isArray(value))
|
|
722
|
+
return true;
|
|
723
|
+
const proto = Object.getPrototypeOf(value);
|
|
724
|
+
return proto === Object.prototype || proto === null;
|
|
725
|
+
}
|
|
706
726
|
// src/runtime/events/EventBinder.ts
|
|
707
727
|
class EventBinder {
|
|
708
728
|
bind(el, eventType, handlerName, owner, cleanupTarget = owner) {
|
|
@@ -3161,7 +3181,14 @@ function serializeNodes(nodes) {
|
|
|
3161
3181
|
|
|
3162
3182
|
// src/ssg/render.ts
|
|
3163
3183
|
var MAX_BUILD_ROUNDS = 6;
|
|
3164
|
-
|
|
3184
|
+
var queue = Promise.resolve();
|
|
3185
|
+
function renderPage(options) {
|
|
3186
|
+
const next = queue.then(() => renderPageNow(options));
|
|
3187
|
+
queue = next.catch(() => {
|
|
3188
|
+
});
|
|
3189
|
+
return next;
|
|
3190
|
+
}
|
|
3191
|
+
async function renderPageNow(options) {
|
|
3165
3192
|
const jsdom = await loadJsdom();
|
|
3166
3193
|
if (!jsdom) {
|
|
3167
3194
|
return {
|
package/dist/vite.js
CHANGED
|
@@ -329,7 +329,7 @@ class BindingEvaluator {
|
|
|
329
329
|
}
|
|
330
330
|
if (binding.kind === "prop") {
|
|
331
331
|
const target = binding.target;
|
|
332
|
-
if (
|
|
332
|
+
if (sameValue(target.props[binding.name], value))
|
|
333
333
|
return;
|
|
334
334
|
target.props[binding.name] = value;
|
|
335
335
|
this.onPropChanged(target);
|
|
@@ -442,6 +442,26 @@ function setHidden(el, hidden) {
|
|
|
442
442
|
else
|
|
443
443
|
el.removeAttribute(HIDDEN_ATTR);
|
|
444
444
|
}
|
|
445
|
+
function sameValue(a, b, depth = 0) {
|
|
446
|
+
if (Object.is(a, b))
|
|
447
|
+
return true;
|
|
448
|
+
if (depth > 20 || !isPlain(a) || !isPlain(b))
|
|
449
|
+
return false;
|
|
450
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
451
|
+
return false;
|
|
452
|
+
const keys = Object.keys(a);
|
|
453
|
+
if (keys.length !== Object.keys(b).length)
|
|
454
|
+
return false;
|
|
455
|
+
return keys.every((key) => Object.prototype.hasOwnProperty.call(b, key) && sameValue(a[key], b[key], depth + 1));
|
|
456
|
+
}
|
|
457
|
+
function isPlain(value) {
|
|
458
|
+
if (value === null || typeof value !== "object")
|
|
459
|
+
return false;
|
|
460
|
+
if (Array.isArray(value))
|
|
461
|
+
return true;
|
|
462
|
+
const proto = Object.getPrototypeOf(value);
|
|
463
|
+
return proto === Object.prototype || proto === null;
|
|
464
|
+
}
|
|
445
465
|
// src/runtime/dom/ForBlock.ts
|
|
446
466
|
class Row {
|
|
447
467
|
locals;
|
|
@@ -4552,7 +4572,14 @@ function serializeNodes(nodes) {
|
|
|
4552
4572
|
|
|
4553
4573
|
// src/ssg/render.ts
|
|
4554
4574
|
var MAX_BUILD_ROUNDS = 6;
|
|
4555
|
-
|
|
4575
|
+
var queue = Promise.resolve();
|
|
4576
|
+
function renderPage(options) {
|
|
4577
|
+
const next = queue.then(() => renderPageNow(options));
|
|
4578
|
+
queue = next.catch(() => {
|
|
4579
|
+
});
|
|
4580
|
+
return next;
|
|
4581
|
+
}
|
|
4582
|
+
async function renderPageNow(options) {
|
|
4556
4583
|
const jsdom = await loadJsdom();
|
|
4557
4584
|
if (!jsdom) {
|
|
4558
4585
|
return {
|