@csszyx/runtime 0.10.8 → 0.10.9
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/index.cjs +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
const browser = require('@csszyx/compiler/browser');
|
|
4
4
|
const colorVar = require('@csszyx/compiler/color-var');
|
|
5
5
|
|
|
6
|
+
function sortStrings(values) {
|
|
7
|
+
return [...values].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
function verifyRecoveryToken(element, manifest) {
|
|
7
11
|
const token = element.getAttribute("data-sz-recovery-token");
|
|
8
12
|
if (!token) {
|
|
@@ -145,7 +149,7 @@ function verifyMangleChecksum(expectedChecksum) {
|
|
|
145
149
|
return actualChecksum === expectedChecksum;
|
|
146
150
|
}
|
|
147
151
|
async function computeMangleChecksumAsync(map) {
|
|
148
|
-
const canonical = Object.keys(map)
|
|
152
|
+
const canonical = sortStrings(Object.keys(map)).map((key) => `${key}:${map[key]}`).join("|");
|
|
149
153
|
const bytes = new TextEncoder().encode(canonical);
|
|
150
154
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
151
155
|
let hex = "";
|
|
@@ -298,7 +302,7 @@ function getSSRContext() {
|
|
|
298
302
|
};
|
|
299
303
|
}
|
|
300
304
|
function validateHydrationClass(className, expectedClassName) {
|
|
301
|
-
const normalize = (s) => s.split(/\s+/).filter(Boolean)
|
|
305
|
+
const normalize = (s) => sortStrings(s.split(/\s+/).filter(Boolean)).join(" ");
|
|
302
306
|
return normalize(className) === normalize(expectedClassName);
|
|
303
307
|
}
|
|
304
308
|
function startHydration() {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { MAX_SZ_DEPTH, SzDepthError, transform as transform$1, isForbiddenSzKey } from '@csszyx/compiler/browser';
|
|
2
2
|
export { __szColorVar } from '@csszyx/compiler/color-var';
|
|
3
3
|
|
|
4
|
+
function sortStrings(values) {
|
|
5
|
+
return [...values].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
function verifyRecoveryToken(element, manifest) {
|
|
5
9
|
const token = element.getAttribute("data-sz-recovery-token");
|
|
6
10
|
if (!token) {
|
|
@@ -143,7 +147,7 @@ function verifyMangleChecksum(expectedChecksum) {
|
|
|
143
147
|
return actualChecksum === expectedChecksum;
|
|
144
148
|
}
|
|
145
149
|
async function computeMangleChecksumAsync(map) {
|
|
146
|
-
const canonical = Object.keys(map)
|
|
150
|
+
const canonical = sortStrings(Object.keys(map)).map((key) => `${key}:${map[key]}`).join("|");
|
|
147
151
|
const bytes = new TextEncoder().encode(canonical);
|
|
148
152
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
149
153
|
let hex = "";
|
|
@@ -296,7 +300,7 @@ function getSSRContext() {
|
|
|
296
300
|
};
|
|
297
301
|
}
|
|
298
302
|
function validateHydrationClass(className, expectedClassName) {
|
|
299
|
-
const normalize = (s) => s.split(/\s+/).filter(Boolean)
|
|
303
|
+
const normalize = (s) => sortStrings(s.split(/\s+/).filter(Boolean)).join(" ");
|
|
300
304
|
return normalize(className) === normalize(expectedClassName);
|
|
301
305
|
}
|
|
302
306
|
function startHydration() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/runtime",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.9",
|
|
4
4
|
"description": "Runtime helpers and hydration guards for csszyx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csszyx",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"dist"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@csszyx/compiler": "0.10.
|
|
53
|
-
"@csszyx/core": "0.10.
|
|
52
|
+
"@csszyx/compiler": "0.10.9",
|
|
53
|
+
"@csszyx/core": "0.10.9"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^20.11.0",
|
|
57
57
|
"jsdom": "^23.0.0",
|
|
58
58
|
"typescript": "^6.0.3",
|
|
59
59
|
"vite-plugin-wasm": "^3.3.0",
|
|
60
|
-
"vitest": "^4.1.
|
|
60
|
+
"vitest": "^4.1.9",
|
|
61
61
|
"unbuild": "^3.6.1"
|
|
62
62
|
},
|
|
63
63
|
"optionalDependencies": {
|