@lightspeed-js/core 0.4.1 → 0.4.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/compile.js +6 -4
- package/dist/index.js +3 -2
- package/dist/ssg.js +9 -6
- package/dist/vite.js +9 -6
- package/package.json +1 -1
package/dist/compile.js
CHANGED
|
@@ -345,15 +345,17 @@ function transformRules(css, scopes, scopeId, renames) {
|
|
|
345
345
|
const bodyEnd = matchBrace(css, i);
|
|
346
346
|
const body = css.slice(i + 1, bodyEnd);
|
|
347
347
|
i = bodyEnd + 1;
|
|
348
|
-
const
|
|
348
|
+
const leading = /^(?:\s|\/\*[\s\S]*?\*\/)*/.exec(prelude.text)?.[0] ?? "";
|
|
349
|
+
const rule = prelude.text.slice(leading.length);
|
|
350
|
+
const trimmed = rule.trim();
|
|
349
351
|
if (trimmed.startsWith("@")) {
|
|
350
352
|
const name = trimmed.split(/[\s({]/)[0].toLowerCase();
|
|
351
353
|
if (name.endsWith("keyframes")) {
|
|
352
|
-
out += `${renameKeyframe(
|
|
354
|
+
out += `${leading}${renameKeyframe(rule, scopeId)}{${body}}`;
|
|
353
355
|
} else if (NESTED_AT_RULES.has(name)) {
|
|
354
|
-
out += `${
|
|
356
|
+
out += `${leading}${rule}{${transformRules(body, scopes, scopeId, renames)}}`;
|
|
355
357
|
} else {
|
|
356
|
-
out += `${
|
|
358
|
+
out += `${leading}${rule}{${body}}`;
|
|
357
359
|
}
|
|
358
360
|
continue;
|
|
359
361
|
}
|
package/dist/index.js
CHANGED
|
@@ -1495,6 +1495,8 @@ class Mounter {
|
|
|
1495
1495
|
const children = Array.from(node.childNodes);
|
|
1496
1496
|
for (let i = 0;i < children.length; i++) {
|
|
1497
1497
|
const child = children[i];
|
|
1498
|
+
if (child.parentNode !== node)
|
|
1499
|
+
continue;
|
|
1498
1500
|
if (!isMarkerStart(child)) {
|
|
1499
1501
|
this.collect(child, context, skip, markers);
|
|
1500
1502
|
continue;
|
|
@@ -2647,6 +2649,7 @@ class LightspeedRuntime {
|
|
|
2647
2649
|
fail(`Error executing logic for ${instance.id}:`, error);
|
|
2648
2650
|
}
|
|
2649
2651
|
}
|
|
2652
|
+
this.runUpdateCallbacks(instance);
|
|
2650
2653
|
this.instances.set(instanceId, instance);
|
|
2651
2654
|
return instance;
|
|
2652
2655
|
}
|
|
@@ -2677,8 +2680,6 @@ class LightspeedRuntime {
|
|
|
2677
2680
|
instance.addLogicCleanup(callback);
|
|
2678
2681
|
},
|
|
2679
2682
|
onUpdate: (callback) => {
|
|
2680
|
-
if (this.ssg)
|
|
2681
|
-
return;
|
|
2682
2683
|
instance.updateCallbacks.push(callback);
|
|
2683
2684
|
},
|
|
2684
2685
|
defineProps: (propsDefinition) => {
|
package/dist/ssg.js
CHANGED
|
@@ -1518,6 +1518,8 @@ class Mounter {
|
|
|
1518
1518
|
const children = Array.from(node.childNodes);
|
|
1519
1519
|
for (let i = 0;i < children.length; i++) {
|
|
1520
1520
|
const child = children[i];
|
|
1521
|
+
if (child.parentNode !== node)
|
|
1522
|
+
continue;
|
|
1521
1523
|
if (!isMarkerStart(child)) {
|
|
1522
1524
|
this.collect(child, context, skip, markers);
|
|
1523
1525
|
continue;
|
|
@@ -2755,6 +2757,7 @@ class LightspeedRuntime {
|
|
|
2755
2757
|
fail(`Error executing logic for ${instance.id}:`, error);
|
|
2756
2758
|
}
|
|
2757
2759
|
}
|
|
2760
|
+
this.runUpdateCallbacks(instance);
|
|
2758
2761
|
this.instances.set(instanceId, instance);
|
|
2759
2762
|
return instance;
|
|
2760
2763
|
}
|
|
@@ -2785,8 +2788,6 @@ class LightspeedRuntime {
|
|
|
2785
2788
|
instance.addLogicCleanup(callback);
|
|
2786
2789
|
},
|
|
2787
2790
|
onUpdate: (callback) => {
|
|
2788
|
-
if (this.ssg)
|
|
2789
|
-
return;
|
|
2790
2791
|
instance.updateCallbacks.push(callback);
|
|
2791
2792
|
},
|
|
2792
2793
|
defineProps: (propsDefinition) => {
|
|
@@ -3957,15 +3958,17 @@ function transformRules(css, scopes, scopeId, renames) {
|
|
|
3957
3958
|
const bodyEnd = matchBrace(css, i);
|
|
3958
3959
|
const body = css.slice(i + 1, bodyEnd);
|
|
3959
3960
|
i = bodyEnd + 1;
|
|
3960
|
-
const
|
|
3961
|
+
const leading = /^(?:\s|\/\*[\s\S]*?\*\/)*/.exec(prelude.text)?.[0] ?? "";
|
|
3962
|
+
const rule = prelude.text.slice(leading.length);
|
|
3963
|
+
const trimmed = rule.trim();
|
|
3961
3964
|
if (trimmed.startsWith("@")) {
|
|
3962
3965
|
const name = trimmed.split(/[\s({]/)[0].toLowerCase();
|
|
3963
3966
|
if (name.endsWith("keyframes")) {
|
|
3964
|
-
out += `${renameKeyframe(
|
|
3967
|
+
out += `${leading}${renameKeyframe(rule, scopeId)}{${body}}`;
|
|
3965
3968
|
} else if (NESTED_AT_RULES.has(name)) {
|
|
3966
|
-
out += `${
|
|
3969
|
+
out += `${leading}${rule}{${transformRules(body, scopes, scopeId, renames)}}`;
|
|
3967
3970
|
} else {
|
|
3968
|
-
out += `${
|
|
3971
|
+
out += `${leading}${rule}{${body}}`;
|
|
3969
3972
|
}
|
|
3970
3973
|
continue;
|
|
3971
3974
|
}
|
package/dist/vite.js
CHANGED
|
@@ -949,6 +949,8 @@ class Mounter {
|
|
|
949
949
|
const children = Array.from(node.childNodes);
|
|
950
950
|
for (let i = 0;i < children.length; i++) {
|
|
951
951
|
const child = children[i];
|
|
952
|
+
if (child.parentNode !== node)
|
|
953
|
+
continue;
|
|
952
954
|
if (!isMarkerStart(child)) {
|
|
953
955
|
this.collect(child, context, skip, markers);
|
|
954
956
|
continue;
|
|
@@ -2217,15 +2219,17 @@ function transformRules(css, scopes, scopeId, renames) {
|
|
|
2217
2219
|
const bodyEnd = matchBrace(css, i);
|
|
2218
2220
|
const body = css.slice(i + 1, bodyEnd);
|
|
2219
2221
|
i = bodyEnd + 1;
|
|
2220
|
-
const
|
|
2222
|
+
const leading = /^(?:\s|\/\*[\s\S]*?\*\/)*/.exec(prelude.text)?.[0] ?? "";
|
|
2223
|
+
const rule = prelude.text.slice(leading.length);
|
|
2224
|
+
const trimmed = rule.trim();
|
|
2221
2225
|
if (trimmed.startsWith("@")) {
|
|
2222
2226
|
const name = trimmed.split(/[\s({]/)[0].toLowerCase();
|
|
2223
2227
|
if (name.endsWith("keyframes")) {
|
|
2224
|
-
out += `${renameKeyframe(
|
|
2228
|
+
out += `${leading}${renameKeyframe(rule, scopeId)}{${body}}`;
|
|
2225
2229
|
} else if (NESTED_AT_RULES.has(name)) {
|
|
2226
|
-
out += `${
|
|
2230
|
+
out += `${leading}${rule}{${transformRules(body, scopes, scopeId, renames)}}`;
|
|
2227
2231
|
} else {
|
|
2228
|
-
out += `${
|
|
2232
|
+
out += `${leading}${rule}{${body}}`;
|
|
2229
2233
|
}
|
|
2230
2234
|
continue;
|
|
2231
2235
|
}
|
|
@@ -4144,6 +4148,7 @@ class LightspeedRuntime {
|
|
|
4144
4148
|
fail(`Error executing logic for ${instance.id}:`, error);
|
|
4145
4149
|
}
|
|
4146
4150
|
}
|
|
4151
|
+
this.runUpdateCallbacks(instance);
|
|
4147
4152
|
this.instances.set(instanceId, instance);
|
|
4148
4153
|
return instance;
|
|
4149
4154
|
}
|
|
@@ -4174,8 +4179,6 @@ class LightspeedRuntime {
|
|
|
4174
4179
|
instance.addLogicCleanup(callback);
|
|
4175
4180
|
},
|
|
4176
4181
|
onUpdate: (callback) => {
|
|
4177
|
-
if (this.ssg)
|
|
4178
|
-
return;
|
|
4179
4182
|
instance.updateCallbacks.push(callback);
|
|
4180
4183
|
},
|
|
4181
4184
|
defineProps: (propsDefinition) => {
|