@csszyx/core 0.9.10 → 0.10.0
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/package.json +9 -9
- package/pkg/csszyx_core.d.ts +43 -39
- package/pkg/csszyx_core_bg.js +96 -92
- package/pkg/csszyx_core_bg.wasm +0 -0
- package/pkg-node/csszyx_core.d.ts +43 -39
- package/pkg-node/csszyx_core.js +96 -92
- package/pkg-node/csszyx_core_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "WASM core for csszyx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csszyx",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"vitest": "^4.1.6"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@csszyx/core-darwin-arm64": "0.
|
|
50
|
-
"@csszyx/core-darwin-x64": "0.
|
|
51
|
-
"@csszyx/core-linux-arm64-
|
|
52
|
-
"@csszyx/core-linux-x64-gnu": "0.
|
|
53
|
-
"@csszyx/core-linux-arm64-
|
|
54
|
-
"@csszyx/core-linux-x64-musl": "0.
|
|
55
|
-
"@csszyx/core-win32-
|
|
56
|
-
"@csszyx/core-win32-
|
|
49
|
+
"@csszyx/core-darwin-arm64": "0.10.0",
|
|
50
|
+
"@csszyx/core-darwin-x64": "0.10.0",
|
|
51
|
+
"@csszyx/core-linux-arm64-gnu": "0.10.0",
|
|
52
|
+
"@csszyx/core-linux-x64-gnu": "0.10.0",
|
|
53
|
+
"@csszyx/core-linux-arm64-musl": "0.10.0",
|
|
54
|
+
"@csszyx/core-linux-x64-musl": "0.10.0",
|
|
55
|
+
"@csszyx/core-win32-x64-msvc": "0.10.0",
|
|
56
|
+
"@csszyx/core-win32-arm64-msvc": "0.10.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "node scripts/preflight.mjs && wasm-pack build --mode no-install --target bundler --out-dir pkg && wasm-pack build --mode no-install --target nodejs --out-dir pkg-node && rm -f pkg/.gitignore pkg-node/.gitignore && node scripts/run-wasm-opt.mjs",
|
package/pkg/csszyx_core.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Transforms a csszyx sz object into a Tailwind CSS className string
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Transforms a csszyx sz object into a Tailwind CSS className string.
|
|
5
|
+
*
|
|
6
|
+
* The runtime WASM path is a thin adapter: it deserializes the JS object into an
|
|
7
|
+
* order-preserving map, converts it to the parser's [`StaticSzObject`] IR, and
|
|
8
|
+
* lowers it through the single oracle-gated pipeline in `transform/lower.rs` — the
|
|
9
|
+
* exact same lowering the static build path uses. There is therefore one lowering
|
|
10
|
+
* core and no second implementation to drift (every special case — css, bgImg,
|
|
11
|
+
* color-opacity, supports/data/not/aria/has, group/peer, every property — is
|
|
12
|
+
* handled in one place). The serde boundary, not the lowering, dominates the
|
|
13
|
+
* runtime cost, so the conversion allocation is negligible.
|
|
10
14
|
* @param {any} val
|
|
11
15
|
* @returns {string}
|
|
12
16
|
*/
|
|
@@ -36,6 +40,32 @@ export function version(): string;
|
|
|
36
40
|
*/
|
|
37
41
|
export function init(): void;
|
|
38
42
|
/**
|
|
43
|
+
* Verifies a token against component information.
|
|
44
|
+
*
|
|
45
|
+
* # Arguments
|
|
46
|
+
*
|
|
47
|
+
* * `token` - Token to verify
|
|
48
|
+
* * `component` - Component name
|
|
49
|
+
* * `path` - File path
|
|
50
|
+
* * `line` - Line number
|
|
51
|
+
* * `column` - Column number
|
|
52
|
+
* * `mode` - Recovery mode
|
|
53
|
+
* * `build_id` - Build identifier
|
|
54
|
+
*
|
|
55
|
+
* # Returns
|
|
56
|
+
*
|
|
57
|
+
* `true` if token matches, `false` otherwise
|
|
58
|
+
* @param {string} token
|
|
59
|
+
* @param {string} component
|
|
60
|
+
* @param {string} path
|
|
61
|
+
* @param {number} line
|
|
62
|
+
* @param {number} column
|
|
63
|
+
* @param {string} mode
|
|
64
|
+
* @param {string} build_id
|
|
65
|
+
* @returns {boolean}
|
|
66
|
+
*/
|
|
67
|
+
export function verify_token(token: string, component: string, path: string, line: number, column: number, mode: string, build_id: string): boolean;
|
|
68
|
+
/**
|
|
39
69
|
* Generates a cryptographic token for a recovery declaration.
|
|
40
70
|
*
|
|
41
71
|
* # Arguments
|
|
@@ -84,31 +114,21 @@ export function init(): void;
|
|
|
84
114
|
*/
|
|
85
115
|
export function generate_token(component: string, path: string, line: number, column: number, mode: string, build_id: string): string;
|
|
86
116
|
/**
|
|
87
|
-
*
|
|
117
|
+
* WASM-exposed checksum verification.
|
|
88
118
|
*
|
|
89
119
|
* # Arguments
|
|
90
120
|
*
|
|
91
|
-
* * `
|
|
92
|
-
* * `
|
|
93
|
-
* * `path` - File path
|
|
94
|
-
* * `line` - Line number
|
|
95
|
-
* * `column` - Column number
|
|
96
|
-
* * `mode` - Recovery mode
|
|
97
|
-
* * `build_id` - Build identifier
|
|
121
|
+
* * `map` - JavaScript object representing the mangle map
|
|
122
|
+
* * `expected_checksum` - The expected checksum string
|
|
98
123
|
*
|
|
99
124
|
* # Returns
|
|
100
125
|
*
|
|
101
|
-
* `true` if
|
|
102
|
-
* @param {
|
|
103
|
-
* @param {string}
|
|
104
|
-
* @param {string} path
|
|
105
|
-
* @param {number} line
|
|
106
|
-
* @param {number} column
|
|
107
|
-
* @param {string} mode
|
|
108
|
-
* @param {string} build_id
|
|
126
|
+
* `true` if checksum matches, `false` otherwise
|
|
127
|
+
* @param {any} map
|
|
128
|
+
* @param {string} expected_checksum
|
|
109
129
|
* @returns {boolean}
|
|
110
130
|
*/
|
|
111
|
-
export function
|
|
131
|
+
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
112
132
|
/**
|
|
113
133
|
* Computes a deterministic SHA-256 checksum for a mangle map.
|
|
114
134
|
*
|
|
@@ -157,22 +177,6 @@ export function verify_token(token: string, component: string, path: string, lin
|
|
|
157
177
|
*/
|
|
158
178
|
export function compute_mangle_checksum(map: any): string;
|
|
159
179
|
/**
|
|
160
|
-
* WASM-exposed checksum verification.
|
|
161
|
-
*
|
|
162
|
-
* # Arguments
|
|
163
|
-
*
|
|
164
|
-
* * `map` - JavaScript object representing the mangle map
|
|
165
|
-
* * `expected_checksum` - The expected checksum string
|
|
166
|
-
*
|
|
167
|
-
* # Returns
|
|
168
|
-
*
|
|
169
|
-
* `true` if checksum matches, `false` otherwise
|
|
170
|
-
* @param {any} map
|
|
171
|
-
* @param {string} expected_checksum
|
|
172
|
-
* @returns {boolean}
|
|
173
|
-
*/
|
|
174
|
-
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
175
|
-
/**
|
|
176
180
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
177
181
|
*
|
|
178
182
|
* # Arguments
|
package/pkg/csszyx_core_bg.js
CHANGED
|
@@ -4,26 +4,6 @@ export function __wbg_set_wasm(val) {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
const heap = new Array(128).fill(undefined);
|
|
8
|
-
|
|
9
|
-
heap.push(undefined, null, true, false);
|
|
10
|
-
|
|
11
|
-
function getObject(idx) { return heap[idx]; }
|
|
12
|
-
|
|
13
|
-
let heap_next = heap.length;
|
|
14
|
-
|
|
15
|
-
function dropObject(idx) {
|
|
16
|
-
if (idx < 132) return;
|
|
17
|
-
heap[idx] = heap_next;
|
|
18
|
-
heap_next = idx;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function takeObject(idx) {
|
|
22
|
-
const ret = getObject(idx);
|
|
23
|
-
dropObject(idx);
|
|
24
|
-
return ret;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
7
|
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
|
28
8
|
|
|
29
9
|
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
@@ -44,6 +24,12 @@ function getStringFromWasm0(ptr, len) {
|
|
|
44
24
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
45
25
|
}
|
|
46
26
|
|
|
27
|
+
const heap = new Array(128).fill(undefined);
|
|
28
|
+
|
|
29
|
+
heap.push(undefined, null, true, false);
|
|
30
|
+
|
|
31
|
+
let heap_next = heap.length;
|
|
32
|
+
|
|
47
33
|
function addHeapObject(obj) {
|
|
48
34
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
49
35
|
const idx = heap_next;
|
|
@@ -53,6 +39,8 @@ function addHeapObject(obj) {
|
|
|
53
39
|
return idx;
|
|
54
40
|
}
|
|
55
41
|
|
|
42
|
+
function getObject(idx) { return heap[idx]; }
|
|
43
|
+
|
|
56
44
|
function isLikeNone(x) {
|
|
57
45
|
return x === undefined || x === null;
|
|
58
46
|
}
|
|
@@ -66,6 +54,18 @@ function getDataViewMemory0() {
|
|
|
66
54
|
return cachedDataViewMemory0;
|
|
67
55
|
}
|
|
68
56
|
|
|
57
|
+
function dropObject(idx) {
|
|
58
|
+
if (idx < 132) return;
|
|
59
|
+
heap[idx] = heap_next;
|
|
60
|
+
heap_next = idx;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function takeObject(idx) {
|
|
64
|
+
const ret = getObject(idx);
|
|
65
|
+
dropObject(idx);
|
|
66
|
+
return ret;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
69
|
let WASM_VECTOR_LEN = 0;
|
|
70
70
|
|
|
71
71
|
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
@@ -189,12 +189,16 @@ function debugString(val) {
|
|
|
189
189
|
return className;
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* Transforms a csszyx sz object into a Tailwind CSS className string
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* -
|
|
196
|
-
*
|
|
197
|
-
*
|
|
192
|
+
* Transforms a csszyx sz object into a Tailwind CSS className string.
|
|
193
|
+
*
|
|
194
|
+
* The runtime WASM path is a thin adapter: it deserializes the JS object into an
|
|
195
|
+
* order-preserving map, converts it to the parser's [`StaticSzObject`] IR, and
|
|
196
|
+
* lowers it through the single oracle-gated pipeline in `transform/lower.rs` — the
|
|
197
|
+
* exact same lowering the static build path uses. There is therefore one lowering
|
|
198
|
+
* core and no second implementation to drift (every special case — css, bgImg,
|
|
199
|
+
* color-opacity, supports/data/not/aria/has, group/peer, every property — is
|
|
200
|
+
* handled in one place). The serde boundary, not the lowering, dominates the
|
|
201
|
+
* runtime cost, so the conversion allocation is negligible.
|
|
198
202
|
* @param {any} val
|
|
199
203
|
* @returns {string}
|
|
200
204
|
*/
|
|
@@ -266,6 +270,46 @@ export function init() {
|
|
|
266
270
|
wasm.init();
|
|
267
271
|
}
|
|
268
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Verifies a token against component information.
|
|
275
|
+
*
|
|
276
|
+
* # Arguments
|
|
277
|
+
*
|
|
278
|
+
* * `token` - Token to verify
|
|
279
|
+
* * `component` - Component name
|
|
280
|
+
* * `path` - File path
|
|
281
|
+
* * `line` - Line number
|
|
282
|
+
* * `column` - Column number
|
|
283
|
+
* * `mode` - Recovery mode
|
|
284
|
+
* * `build_id` - Build identifier
|
|
285
|
+
*
|
|
286
|
+
* # Returns
|
|
287
|
+
*
|
|
288
|
+
* `true` if token matches, `false` otherwise
|
|
289
|
+
* @param {string} token
|
|
290
|
+
* @param {string} component
|
|
291
|
+
* @param {string} path
|
|
292
|
+
* @param {number} line
|
|
293
|
+
* @param {number} column
|
|
294
|
+
* @param {string} mode
|
|
295
|
+
* @param {string} build_id
|
|
296
|
+
* @returns {boolean}
|
|
297
|
+
*/
|
|
298
|
+
export function verify_token(token, component, path, line, column, mode, build_id) {
|
|
299
|
+
const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
300
|
+
const len0 = WASM_VECTOR_LEN;
|
|
301
|
+
const ptr1 = passStringToWasm0(component, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
302
|
+
const len1 = WASM_VECTOR_LEN;
|
|
303
|
+
const ptr2 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
304
|
+
const len2 = WASM_VECTOR_LEN;
|
|
305
|
+
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
306
|
+
const len3 = WASM_VECTOR_LEN;
|
|
307
|
+
const ptr4 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
308
|
+
const len4 = WASM_VECTOR_LEN;
|
|
309
|
+
const ret = wasm.verify_token(ptr0, len0, ptr1, len1, ptr2, len2, line, column, ptr3, len3, ptr4, len4);
|
|
310
|
+
return ret !== 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
269
313
|
/**
|
|
270
314
|
* Generates a cryptographic token for a recovery declaration.
|
|
271
315
|
*
|
|
@@ -339,43 +383,36 @@ export function generate_token(component, path, line, column, mode, build_id) {
|
|
|
339
383
|
}
|
|
340
384
|
|
|
341
385
|
/**
|
|
342
|
-
*
|
|
386
|
+
* WASM-exposed checksum verification.
|
|
343
387
|
*
|
|
344
388
|
* # Arguments
|
|
345
389
|
*
|
|
346
|
-
* * `
|
|
347
|
-
* * `
|
|
348
|
-
* * `path` - File path
|
|
349
|
-
* * `line` - Line number
|
|
350
|
-
* * `column` - Column number
|
|
351
|
-
* * `mode` - Recovery mode
|
|
352
|
-
* * `build_id` - Build identifier
|
|
390
|
+
* * `map` - JavaScript object representing the mangle map
|
|
391
|
+
* * `expected_checksum` - The expected checksum string
|
|
353
392
|
*
|
|
354
393
|
* # Returns
|
|
355
394
|
*
|
|
356
|
-
* `true` if
|
|
357
|
-
* @param {
|
|
358
|
-
* @param {string}
|
|
359
|
-
* @param {string} path
|
|
360
|
-
* @param {number} line
|
|
361
|
-
* @param {number} column
|
|
362
|
-
* @param {string} mode
|
|
363
|
-
* @param {string} build_id
|
|
395
|
+
* `true` if checksum matches, `false` otherwise
|
|
396
|
+
* @param {any} map
|
|
397
|
+
* @param {string} expected_checksum
|
|
364
398
|
* @returns {boolean}
|
|
365
399
|
*/
|
|
366
|
-
export function
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
400
|
+
export function verify_mangle_checksum(map, expected_checksum) {
|
|
401
|
+
try {
|
|
402
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
403
|
+
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
404
|
+
const len0 = WASM_VECTOR_LEN;
|
|
405
|
+
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
406
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
407
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
408
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
409
|
+
if (r2) {
|
|
410
|
+
throw takeObject(r1);
|
|
411
|
+
}
|
|
412
|
+
return r0 !== 0;
|
|
413
|
+
} finally {
|
|
414
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
415
|
+
}
|
|
379
416
|
}
|
|
380
417
|
|
|
381
418
|
/**
|
|
@@ -449,39 +486,6 @@ export function compute_mangle_checksum(map) {
|
|
|
449
486
|
}
|
|
450
487
|
}
|
|
451
488
|
|
|
452
|
-
/**
|
|
453
|
-
* WASM-exposed checksum verification.
|
|
454
|
-
*
|
|
455
|
-
* # Arguments
|
|
456
|
-
*
|
|
457
|
-
* * `map` - JavaScript object representing the mangle map
|
|
458
|
-
* * `expected_checksum` - The expected checksum string
|
|
459
|
-
*
|
|
460
|
-
* # Returns
|
|
461
|
-
*
|
|
462
|
-
* `true` if checksum matches, `false` otherwise
|
|
463
|
-
* @param {any} map
|
|
464
|
-
* @param {string} expected_checksum
|
|
465
|
-
* @returns {boolean}
|
|
466
|
-
*/
|
|
467
|
-
export function verify_mangle_checksum(map, expected_checksum) {
|
|
468
|
-
try {
|
|
469
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
470
|
-
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
471
|
-
const len0 = WASM_VECTOR_LEN;
|
|
472
|
-
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
473
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
474
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
475
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
476
|
-
if (r2) {
|
|
477
|
-
throw takeObject(r1);
|
|
478
|
-
}
|
|
479
|
-
return r0 !== 0;
|
|
480
|
-
} finally {
|
|
481
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
489
|
/**
|
|
486
490
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
487
491
|
*
|
|
@@ -632,10 +636,6 @@ export class WasmCollisionDetector {
|
|
|
632
636
|
}
|
|
633
637
|
}
|
|
634
638
|
|
|
635
|
-
export function __wbindgen_object_drop_ref(arg0) {
|
|
636
|
-
takeObject(arg0);
|
|
637
|
-
};
|
|
638
|
-
|
|
639
639
|
export function __wbindgen_error_new(arg0, arg1) {
|
|
640
640
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
641
641
|
return addHeapObject(ret);
|
|
@@ -669,6 +669,10 @@ export function __wbindgen_jsval_eq(arg0, arg1) {
|
|
|
669
669
|
return ret;
|
|
670
670
|
};
|
|
671
671
|
|
|
672
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
673
|
+
takeObject(arg0);
|
|
674
|
+
};
|
|
675
|
+
|
|
672
676
|
export function __wbindgen_string_get(arg0, arg1) {
|
|
673
677
|
const obj = getObject(arg1);
|
|
674
678
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
package/pkg/csszyx_core_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Transforms a csszyx sz object into a Tailwind CSS className string
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Transforms a csszyx sz object into a Tailwind CSS className string.
|
|
5
|
+
*
|
|
6
|
+
* The runtime WASM path is a thin adapter: it deserializes the JS object into an
|
|
7
|
+
* order-preserving map, converts it to the parser's [`StaticSzObject`] IR, and
|
|
8
|
+
* lowers it through the single oracle-gated pipeline in `transform/lower.rs` — the
|
|
9
|
+
* exact same lowering the static build path uses. There is therefore one lowering
|
|
10
|
+
* core and no second implementation to drift (every special case — css, bgImg,
|
|
11
|
+
* color-opacity, supports/data/not/aria/has, group/peer, every property — is
|
|
12
|
+
* handled in one place). The serde boundary, not the lowering, dominates the
|
|
13
|
+
* runtime cost, so the conversion allocation is negligible.
|
|
10
14
|
* @param {any} val
|
|
11
15
|
* @returns {string}
|
|
12
16
|
*/
|
|
@@ -36,6 +40,32 @@ export function version(): string;
|
|
|
36
40
|
*/
|
|
37
41
|
export function init(): void;
|
|
38
42
|
/**
|
|
43
|
+
* Verifies a token against component information.
|
|
44
|
+
*
|
|
45
|
+
* # Arguments
|
|
46
|
+
*
|
|
47
|
+
* * `token` - Token to verify
|
|
48
|
+
* * `component` - Component name
|
|
49
|
+
* * `path` - File path
|
|
50
|
+
* * `line` - Line number
|
|
51
|
+
* * `column` - Column number
|
|
52
|
+
* * `mode` - Recovery mode
|
|
53
|
+
* * `build_id` - Build identifier
|
|
54
|
+
*
|
|
55
|
+
* # Returns
|
|
56
|
+
*
|
|
57
|
+
* `true` if token matches, `false` otherwise
|
|
58
|
+
* @param {string} token
|
|
59
|
+
* @param {string} component
|
|
60
|
+
* @param {string} path
|
|
61
|
+
* @param {number} line
|
|
62
|
+
* @param {number} column
|
|
63
|
+
* @param {string} mode
|
|
64
|
+
* @param {string} build_id
|
|
65
|
+
* @returns {boolean}
|
|
66
|
+
*/
|
|
67
|
+
export function verify_token(token: string, component: string, path: string, line: number, column: number, mode: string, build_id: string): boolean;
|
|
68
|
+
/**
|
|
39
69
|
* Generates a cryptographic token for a recovery declaration.
|
|
40
70
|
*
|
|
41
71
|
* # Arguments
|
|
@@ -84,31 +114,21 @@ export function init(): void;
|
|
|
84
114
|
*/
|
|
85
115
|
export function generate_token(component: string, path: string, line: number, column: number, mode: string, build_id: string): string;
|
|
86
116
|
/**
|
|
87
|
-
*
|
|
117
|
+
* WASM-exposed checksum verification.
|
|
88
118
|
*
|
|
89
119
|
* # Arguments
|
|
90
120
|
*
|
|
91
|
-
* * `
|
|
92
|
-
* * `
|
|
93
|
-
* * `path` - File path
|
|
94
|
-
* * `line` - Line number
|
|
95
|
-
* * `column` - Column number
|
|
96
|
-
* * `mode` - Recovery mode
|
|
97
|
-
* * `build_id` - Build identifier
|
|
121
|
+
* * `map` - JavaScript object representing the mangle map
|
|
122
|
+
* * `expected_checksum` - The expected checksum string
|
|
98
123
|
*
|
|
99
124
|
* # Returns
|
|
100
125
|
*
|
|
101
|
-
* `true` if
|
|
102
|
-
* @param {
|
|
103
|
-
* @param {string}
|
|
104
|
-
* @param {string} path
|
|
105
|
-
* @param {number} line
|
|
106
|
-
* @param {number} column
|
|
107
|
-
* @param {string} mode
|
|
108
|
-
* @param {string} build_id
|
|
126
|
+
* `true` if checksum matches, `false` otherwise
|
|
127
|
+
* @param {any} map
|
|
128
|
+
* @param {string} expected_checksum
|
|
109
129
|
* @returns {boolean}
|
|
110
130
|
*/
|
|
111
|
-
export function
|
|
131
|
+
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
112
132
|
/**
|
|
113
133
|
* Computes a deterministic SHA-256 checksum for a mangle map.
|
|
114
134
|
*
|
|
@@ -157,22 +177,6 @@ export function verify_token(token: string, component: string, path: string, lin
|
|
|
157
177
|
*/
|
|
158
178
|
export function compute_mangle_checksum(map: any): string;
|
|
159
179
|
/**
|
|
160
|
-
* WASM-exposed checksum verification.
|
|
161
|
-
*
|
|
162
|
-
* # Arguments
|
|
163
|
-
*
|
|
164
|
-
* * `map` - JavaScript object representing the mangle map
|
|
165
|
-
* * `expected_checksum` - The expected checksum string
|
|
166
|
-
*
|
|
167
|
-
* # Returns
|
|
168
|
-
*
|
|
169
|
-
* `true` if checksum matches, `false` otherwise
|
|
170
|
-
* @param {any} map
|
|
171
|
-
* @param {string} expected_checksum
|
|
172
|
-
* @returns {boolean}
|
|
173
|
-
*/
|
|
174
|
-
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
175
|
-
/**
|
|
176
180
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
177
181
|
*
|
|
178
182
|
* # Arguments
|
package/pkg-node/csszyx_core.js
CHANGED
|
@@ -4,26 +4,6 @@ imports['__wbindgen_placeholder__'] = module.exports;
|
|
|
4
4
|
let wasm;
|
|
5
5
|
const { TextDecoder, TextEncoder } = require(`util`);
|
|
6
6
|
|
|
7
|
-
const heap = new Array(128).fill(undefined);
|
|
8
|
-
|
|
9
|
-
heap.push(undefined, null, true, false);
|
|
10
|
-
|
|
11
|
-
function getObject(idx) { return heap[idx]; }
|
|
12
|
-
|
|
13
|
-
let heap_next = heap.length;
|
|
14
|
-
|
|
15
|
-
function dropObject(idx) {
|
|
16
|
-
if (idx < 132) return;
|
|
17
|
-
heap[idx] = heap_next;
|
|
18
|
-
heap_next = idx;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function takeObject(idx) {
|
|
22
|
-
const ret = getObject(idx);
|
|
23
|
-
dropObject(idx);
|
|
24
|
-
return ret;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
7
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
28
8
|
|
|
29
9
|
cachedTextDecoder.decode();
|
|
@@ -42,6 +22,12 @@ function getStringFromWasm0(ptr, len) {
|
|
|
42
22
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
43
23
|
}
|
|
44
24
|
|
|
25
|
+
const heap = new Array(128).fill(undefined);
|
|
26
|
+
|
|
27
|
+
heap.push(undefined, null, true, false);
|
|
28
|
+
|
|
29
|
+
let heap_next = heap.length;
|
|
30
|
+
|
|
45
31
|
function addHeapObject(obj) {
|
|
46
32
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
47
33
|
const idx = heap_next;
|
|
@@ -51,6 +37,8 @@ function addHeapObject(obj) {
|
|
|
51
37
|
return idx;
|
|
52
38
|
}
|
|
53
39
|
|
|
40
|
+
function getObject(idx) { return heap[idx]; }
|
|
41
|
+
|
|
54
42
|
function isLikeNone(x) {
|
|
55
43
|
return x === undefined || x === null;
|
|
56
44
|
}
|
|
@@ -64,6 +52,18 @@ function getDataViewMemory0() {
|
|
|
64
52
|
return cachedDataViewMemory0;
|
|
65
53
|
}
|
|
66
54
|
|
|
55
|
+
function dropObject(idx) {
|
|
56
|
+
if (idx < 132) return;
|
|
57
|
+
heap[idx] = heap_next;
|
|
58
|
+
heap_next = idx;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function takeObject(idx) {
|
|
62
|
+
const ret = getObject(idx);
|
|
63
|
+
dropObject(idx);
|
|
64
|
+
return ret;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
67
|
let WASM_VECTOR_LEN = 0;
|
|
68
68
|
|
|
69
69
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -185,12 +185,16 @@ function debugString(val) {
|
|
|
185
185
|
return className;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* Transforms a csszyx sz object into a Tailwind CSS className string
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* -
|
|
192
|
-
*
|
|
193
|
-
*
|
|
188
|
+
* Transforms a csszyx sz object into a Tailwind CSS className string.
|
|
189
|
+
*
|
|
190
|
+
* The runtime WASM path is a thin adapter: it deserializes the JS object into an
|
|
191
|
+
* order-preserving map, converts it to the parser's [`StaticSzObject`] IR, and
|
|
192
|
+
* lowers it through the single oracle-gated pipeline in `transform/lower.rs` — the
|
|
193
|
+
* exact same lowering the static build path uses. There is therefore one lowering
|
|
194
|
+
* core and no second implementation to drift (every special case — css, bgImg,
|
|
195
|
+
* color-opacity, supports/data/not/aria/has, group/peer, every property — is
|
|
196
|
+
* handled in one place). The serde boundary, not the lowering, dominates the
|
|
197
|
+
* runtime cost, so the conversion allocation is negligible.
|
|
194
198
|
* @param {any} val
|
|
195
199
|
* @returns {string}
|
|
196
200
|
*/
|
|
@@ -262,6 +266,46 @@ module.exports.init = function() {
|
|
|
262
266
|
wasm.init();
|
|
263
267
|
};
|
|
264
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Verifies a token against component information.
|
|
271
|
+
*
|
|
272
|
+
* # Arguments
|
|
273
|
+
*
|
|
274
|
+
* * `token` - Token to verify
|
|
275
|
+
* * `component` - Component name
|
|
276
|
+
* * `path` - File path
|
|
277
|
+
* * `line` - Line number
|
|
278
|
+
* * `column` - Column number
|
|
279
|
+
* * `mode` - Recovery mode
|
|
280
|
+
* * `build_id` - Build identifier
|
|
281
|
+
*
|
|
282
|
+
* # Returns
|
|
283
|
+
*
|
|
284
|
+
* `true` if token matches, `false` otherwise
|
|
285
|
+
* @param {string} token
|
|
286
|
+
* @param {string} component
|
|
287
|
+
* @param {string} path
|
|
288
|
+
* @param {number} line
|
|
289
|
+
* @param {number} column
|
|
290
|
+
* @param {string} mode
|
|
291
|
+
* @param {string} build_id
|
|
292
|
+
* @returns {boolean}
|
|
293
|
+
*/
|
|
294
|
+
module.exports.verify_token = function(token, component, path, line, column, mode, build_id) {
|
|
295
|
+
const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
296
|
+
const len0 = WASM_VECTOR_LEN;
|
|
297
|
+
const ptr1 = passStringToWasm0(component, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
298
|
+
const len1 = WASM_VECTOR_LEN;
|
|
299
|
+
const ptr2 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
300
|
+
const len2 = WASM_VECTOR_LEN;
|
|
301
|
+
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
302
|
+
const len3 = WASM_VECTOR_LEN;
|
|
303
|
+
const ptr4 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
304
|
+
const len4 = WASM_VECTOR_LEN;
|
|
305
|
+
const ret = wasm.verify_token(ptr0, len0, ptr1, len1, ptr2, len2, line, column, ptr3, len3, ptr4, len4);
|
|
306
|
+
return ret !== 0;
|
|
307
|
+
};
|
|
308
|
+
|
|
265
309
|
/**
|
|
266
310
|
* Generates a cryptographic token for a recovery declaration.
|
|
267
311
|
*
|
|
@@ -335,43 +379,36 @@ module.exports.generate_token = function(component, path, line, column, mode, bu
|
|
|
335
379
|
};
|
|
336
380
|
|
|
337
381
|
/**
|
|
338
|
-
*
|
|
382
|
+
* WASM-exposed checksum verification.
|
|
339
383
|
*
|
|
340
384
|
* # Arguments
|
|
341
385
|
*
|
|
342
|
-
* * `
|
|
343
|
-
* * `
|
|
344
|
-
* * `path` - File path
|
|
345
|
-
* * `line` - Line number
|
|
346
|
-
* * `column` - Column number
|
|
347
|
-
* * `mode` - Recovery mode
|
|
348
|
-
* * `build_id` - Build identifier
|
|
386
|
+
* * `map` - JavaScript object representing the mangle map
|
|
387
|
+
* * `expected_checksum` - The expected checksum string
|
|
349
388
|
*
|
|
350
389
|
* # Returns
|
|
351
390
|
*
|
|
352
|
-
* `true` if
|
|
353
|
-
* @param {
|
|
354
|
-
* @param {string}
|
|
355
|
-
* @param {string} path
|
|
356
|
-
* @param {number} line
|
|
357
|
-
* @param {number} column
|
|
358
|
-
* @param {string} mode
|
|
359
|
-
* @param {string} build_id
|
|
391
|
+
* `true` if checksum matches, `false` otherwise
|
|
392
|
+
* @param {any} map
|
|
393
|
+
* @param {string} expected_checksum
|
|
360
394
|
* @returns {boolean}
|
|
361
395
|
*/
|
|
362
|
-
module.exports.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
396
|
+
module.exports.verify_mangle_checksum = function(map, expected_checksum) {
|
|
397
|
+
try {
|
|
398
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
399
|
+
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
400
|
+
const len0 = WASM_VECTOR_LEN;
|
|
401
|
+
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
402
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
403
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
404
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
405
|
+
if (r2) {
|
|
406
|
+
throw takeObject(r1);
|
|
407
|
+
}
|
|
408
|
+
return r0 !== 0;
|
|
409
|
+
} finally {
|
|
410
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
411
|
+
}
|
|
375
412
|
};
|
|
376
413
|
|
|
377
414
|
/**
|
|
@@ -445,39 +482,6 @@ module.exports.compute_mangle_checksum = function(map) {
|
|
|
445
482
|
}
|
|
446
483
|
};
|
|
447
484
|
|
|
448
|
-
/**
|
|
449
|
-
* WASM-exposed checksum verification.
|
|
450
|
-
*
|
|
451
|
-
* # Arguments
|
|
452
|
-
*
|
|
453
|
-
* * `map` - JavaScript object representing the mangle map
|
|
454
|
-
* * `expected_checksum` - The expected checksum string
|
|
455
|
-
*
|
|
456
|
-
* # Returns
|
|
457
|
-
*
|
|
458
|
-
* `true` if checksum matches, `false` otherwise
|
|
459
|
-
* @param {any} map
|
|
460
|
-
* @param {string} expected_checksum
|
|
461
|
-
* @returns {boolean}
|
|
462
|
-
*/
|
|
463
|
-
module.exports.verify_mangle_checksum = function(map, expected_checksum) {
|
|
464
|
-
try {
|
|
465
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
466
|
-
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
467
|
-
const len0 = WASM_VECTOR_LEN;
|
|
468
|
-
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
469
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
470
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
471
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
472
|
-
if (r2) {
|
|
473
|
-
throw takeObject(r1);
|
|
474
|
-
}
|
|
475
|
-
return r0 !== 0;
|
|
476
|
-
} finally {
|
|
477
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
|
|
481
485
|
/**
|
|
482
486
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
483
487
|
*
|
|
@@ -629,10 +633,6 @@ class WasmCollisionDetector {
|
|
|
629
633
|
}
|
|
630
634
|
module.exports.WasmCollisionDetector = WasmCollisionDetector;
|
|
631
635
|
|
|
632
|
-
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
633
|
-
takeObject(arg0);
|
|
634
|
-
};
|
|
635
|
-
|
|
636
636
|
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
637
637
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
638
638
|
return addHeapObject(ret);
|
|
@@ -666,6 +666,10 @@ module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
|
|
|
666
666
|
return ret;
|
|
667
667
|
};
|
|
668
668
|
|
|
669
|
+
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
670
|
+
takeObject(arg0);
|
|
671
|
+
};
|
|
672
|
+
|
|
669
673
|
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
670
674
|
const obj = getObject(arg1);
|
|
671
675
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
Binary file
|