csskit 0.0.26-canary.bf4161bf99 → 0.0.26
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/bundle/csskit_wasm.d.ts +22 -0
- package/bundle/csskit_wasm.js +9 -0
- package/bundle/csskit_wasm_bg.js +528 -0
- package/bundle/csskit_wasm_bg.wasm +0 -0
- package/bundle/csskit_wasm_bg.wasm.d.ts +17 -0
- package/csskit_wasm_bg.wasm +0 -0
- package/csskit_wasm_bg.wasm.d.ts +17 -0
- package/index.d.ts +22 -0
- package/index.js +540 -0
- package/package.json +26 -11
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class SerializableParserResult {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
readonly ast: any;
|
|
9
|
+
readonly diagnostics: any[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function format(source_text: string, options: any): string;
|
|
13
|
+
|
|
14
|
+
export function lex(source_text: string): any;
|
|
15
|
+
|
|
16
|
+
export function main(): void;
|
|
17
|
+
|
|
18
|
+
export function minify(source_text: string): string;
|
|
19
|
+
|
|
20
|
+
export function parse(source_text: string): SerializableParserResult;
|
|
21
|
+
|
|
22
|
+
export function parse_error_report(source_text: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./csskit_wasm.d.ts" */
|
|
2
|
+
import * as wasm from "./csskit_wasm_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./csskit_wasm_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
SerializableParserResult, format, lex, main, minify, parse, parse_error_report
|
|
9
|
+
} from "./csskit_wasm_bg.js";
|
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
export class SerializableParserResult {
|
|
2
|
+
static __wrap(ptr) {
|
|
3
|
+
const obj = Object.create(SerializableParserResult.prototype);
|
|
4
|
+
obj.__wbg_ptr = ptr;
|
|
5
|
+
SerializableParserResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
6
|
+
return obj;
|
|
7
|
+
}
|
|
8
|
+
__destroy_into_raw() {
|
|
9
|
+
const ptr = this.__wbg_ptr;
|
|
10
|
+
this.__wbg_ptr = 0;
|
|
11
|
+
SerializableParserResultFinalization.unregister(this);
|
|
12
|
+
return ptr;
|
|
13
|
+
}
|
|
14
|
+
free() {
|
|
15
|
+
const ptr = this.__destroy_into_raw();
|
|
16
|
+
wasm.__wbg_serializableparserresult_free(ptr, 0);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @returns {any}
|
|
20
|
+
*/
|
|
21
|
+
get ast() {
|
|
22
|
+
const ret = wasm.serializableparserresult_ast(this.__wbg_ptr);
|
|
23
|
+
return takeObject(ret);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @returns {any[]}
|
|
27
|
+
*/
|
|
28
|
+
get diagnostics() {
|
|
29
|
+
try {
|
|
30
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
31
|
+
wasm.serializableparserresult_diagnostics(retptr, this.__wbg_ptr);
|
|
32
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
33
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
34
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
35
|
+
wasm.__wbindgen_export3(r0, r1 * 4, 4);
|
|
36
|
+
return v1;
|
|
37
|
+
} finally {
|
|
38
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (Symbol.dispose) SerializableParserResult.prototype[Symbol.dispose] = SerializableParserResult.prototype.free;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {string} source_text
|
|
46
|
+
* @param {any} options
|
|
47
|
+
* @returns {string}
|
|
48
|
+
*/
|
|
49
|
+
export function format(source_text, options) {
|
|
50
|
+
let deferred3_0;
|
|
51
|
+
let deferred3_1;
|
|
52
|
+
try {
|
|
53
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
54
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
55
|
+
const len0 = WASM_VECTOR_LEN;
|
|
56
|
+
wasm.format(retptr, ptr0, len0, addHeapObject(options));
|
|
57
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
58
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
59
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
60
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
61
|
+
var ptr2 = r0;
|
|
62
|
+
var len2 = r1;
|
|
63
|
+
if (r3) {
|
|
64
|
+
ptr2 = 0; len2 = 0;
|
|
65
|
+
throw takeObject(r2);
|
|
66
|
+
}
|
|
67
|
+
deferred3_0 = ptr2;
|
|
68
|
+
deferred3_1 = len2;
|
|
69
|
+
return getStringFromWasm0(ptr2, len2);
|
|
70
|
+
} finally {
|
|
71
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
72
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param {string} source_text
|
|
78
|
+
* @returns {any}
|
|
79
|
+
*/
|
|
80
|
+
export function lex(source_text) {
|
|
81
|
+
try {
|
|
82
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
83
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
84
|
+
const len0 = WASM_VECTOR_LEN;
|
|
85
|
+
wasm.lex(retptr, ptr0, len0);
|
|
86
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
87
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
88
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
89
|
+
if (r2) {
|
|
90
|
+
throw takeObject(r1);
|
|
91
|
+
}
|
|
92
|
+
return takeObject(r0);
|
|
93
|
+
} finally {
|
|
94
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function main() {
|
|
99
|
+
wasm.main();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param {string} source_text
|
|
104
|
+
* @returns {string}
|
|
105
|
+
*/
|
|
106
|
+
export function minify(source_text) {
|
|
107
|
+
let deferred3_0;
|
|
108
|
+
let deferred3_1;
|
|
109
|
+
try {
|
|
110
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
111
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
112
|
+
const len0 = WASM_VECTOR_LEN;
|
|
113
|
+
wasm.minify(retptr, ptr0, len0);
|
|
114
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
115
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
116
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
117
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
118
|
+
var ptr2 = r0;
|
|
119
|
+
var len2 = r1;
|
|
120
|
+
if (r3) {
|
|
121
|
+
ptr2 = 0; len2 = 0;
|
|
122
|
+
throw takeObject(r2);
|
|
123
|
+
}
|
|
124
|
+
deferred3_0 = ptr2;
|
|
125
|
+
deferred3_1 = len2;
|
|
126
|
+
return getStringFromWasm0(ptr2, len2);
|
|
127
|
+
} finally {
|
|
128
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
129
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @param {string} source_text
|
|
135
|
+
* @returns {SerializableParserResult}
|
|
136
|
+
*/
|
|
137
|
+
export function parse(source_text) {
|
|
138
|
+
try {
|
|
139
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
140
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
wasm.parse(retptr, ptr0, len0);
|
|
143
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
144
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
145
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
146
|
+
if (r2) {
|
|
147
|
+
throw takeObject(r1);
|
|
148
|
+
}
|
|
149
|
+
return SerializableParserResult.__wrap(r0);
|
|
150
|
+
} finally {
|
|
151
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @param {string} source_text
|
|
157
|
+
* @returns {string}
|
|
158
|
+
*/
|
|
159
|
+
export function parse_error_report(source_text) {
|
|
160
|
+
let deferred2_0;
|
|
161
|
+
let deferred2_1;
|
|
162
|
+
try {
|
|
163
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
164
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
165
|
+
const len0 = WASM_VECTOR_LEN;
|
|
166
|
+
wasm.parse_error_report(retptr, ptr0, len0);
|
|
167
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
168
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
169
|
+
deferred2_0 = r0;
|
|
170
|
+
deferred2_1 = r1;
|
|
171
|
+
return getStringFromWasm0(r0, r1);
|
|
172
|
+
} finally {
|
|
173
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
174
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export function __wbg_Error_ef53bc310eb298a0(arg0, arg1) {
|
|
178
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
179
|
+
return addHeapObject(ret);
|
|
180
|
+
}
|
|
181
|
+
export function __wbg_Number_6b506e6536831eaa(arg0) {
|
|
182
|
+
const ret = Number(getObject(arg0));
|
|
183
|
+
return ret;
|
|
184
|
+
}
|
|
185
|
+
export function __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9(arg0) {
|
|
186
|
+
const v = getObject(arg0);
|
|
187
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
188
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
189
|
+
}
|
|
190
|
+
export function __wbg___wbindgen_debug_string_0accd80f45e5faa2(arg0, arg1) {
|
|
191
|
+
const ret = debugString(getObject(arg1));
|
|
192
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
193
|
+
const len1 = WASM_VECTOR_LEN;
|
|
194
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
195
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
196
|
+
}
|
|
197
|
+
export function __wbg___wbindgen_in_70a403a56e771704(arg0, arg1) {
|
|
198
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
199
|
+
return ret;
|
|
200
|
+
}
|
|
201
|
+
export function __wbg___wbindgen_is_object_56732c2bc353f41d(arg0) {
|
|
202
|
+
const val = getObject(arg0);
|
|
203
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
204
|
+
return ret;
|
|
205
|
+
}
|
|
206
|
+
export function __wbg___wbindgen_is_string_c236cabd84a4d769(arg0) {
|
|
207
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
208
|
+
return ret;
|
|
209
|
+
}
|
|
210
|
+
export function __wbg___wbindgen_is_undefined_67b456be8673d3d7(arg0) {
|
|
211
|
+
const ret = getObject(arg0) === undefined;
|
|
212
|
+
return ret;
|
|
213
|
+
}
|
|
214
|
+
export function __wbg___wbindgen_jsval_loose_eq_2c56564c75129511(arg0, arg1) {
|
|
215
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
216
|
+
return ret;
|
|
217
|
+
}
|
|
218
|
+
export function __wbg___wbindgen_number_get_9bb1761122181af2(arg0, arg1) {
|
|
219
|
+
const obj = getObject(arg1);
|
|
220
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
221
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
222
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
223
|
+
}
|
|
224
|
+
export function __wbg___wbindgen_string_get_72bdf95d3ae505b1(arg0, arg1) {
|
|
225
|
+
const obj = getObject(arg1);
|
|
226
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
227
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
228
|
+
var len1 = WASM_VECTOR_LEN;
|
|
229
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
230
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
231
|
+
}
|
|
232
|
+
export function __wbg___wbindgen_throw_1506f2235d1bdba0(arg0, arg1) {
|
|
233
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
234
|
+
}
|
|
235
|
+
export function __wbg_entries_04b37a02507f1713(arg0) {
|
|
236
|
+
const ret = Object.entries(getObject(arg0));
|
|
237
|
+
return addHeapObject(ret);
|
|
238
|
+
}
|
|
239
|
+
export function __wbg_get_2b48c7d0d006a781(arg0, arg1) {
|
|
240
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
241
|
+
return addHeapObject(ret);
|
|
242
|
+
}
|
|
243
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
244
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
245
|
+
return addHeapObject(ret);
|
|
246
|
+
}
|
|
247
|
+
export function __wbg_instanceof_ArrayBuffer_8f49811467741499(arg0) {
|
|
248
|
+
let result;
|
|
249
|
+
try {
|
|
250
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
251
|
+
} catch (_) {
|
|
252
|
+
result = false;
|
|
253
|
+
}
|
|
254
|
+
const ret = result;
|
|
255
|
+
return ret;
|
|
256
|
+
}
|
|
257
|
+
export function __wbg_instanceof_Uint8Array_86f30649f63ef9c2(arg0) {
|
|
258
|
+
let result;
|
|
259
|
+
try {
|
|
260
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
261
|
+
} catch (_) {
|
|
262
|
+
result = false;
|
|
263
|
+
}
|
|
264
|
+
const ret = result;
|
|
265
|
+
return ret;
|
|
266
|
+
}
|
|
267
|
+
export function __wbg_isSafeInteger_66acec27e09e99a7(arg0) {
|
|
268
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
269
|
+
return ret;
|
|
270
|
+
}
|
|
271
|
+
export function __wbg_length_4a591ecaa01354d9(arg0) {
|
|
272
|
+
const ret = getObject(arg0).length;
|
|
273
|
+
return ret;
|
|
274
|
+
}
|
|
275
|
+
export function __wbg_length_66f1a4b2e9026940(arg0) {
|
|
276
|
+
const ret = getObject(arg0).length;
|
|
277
|
+
return ret;
|
|
278
|
+
}
|
|
279
|
+
export function __wbg_new_578aeef4b6b94378(arg0) {
|
|
280
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
281
|
+
return addHeapObject(ret);
|
|
282
|
+
}
|
|
283
|
+
export function __wbg_new_ce1ab61c1c2b300d() {
|
|
284
|
+
const ret = new Object();
|
|
285
|
+
return addHeapObject(ret);
|
|
286
|
+
}
|
|
287
|
+
export function __wbg_new_d90091b82fdf5b91() {
|
|
288
|
+
const ret = new Array();
|
|
289
|
+
return addHeapObject(ret);
|
|
290
|
+
}
|
|
291
|
+
export function __wbg_prototypesetcall_3249fc62a0fafa30(arg0, arg1, arg2) {
|
|
292
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
293
|
+
}
|
|
294
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
295
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
296
|
+
}
|
|
297
|
+
export function __wbg_set_dca99999bba88a9a(arg0, arg1, arg2) {
|
|
298
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
299
|
+
}
|
|
300
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
301
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
302
|
+
const ret = arg0;
|
|
303
|
+
return addHeapObject(ret);
|
|
304
|
+
}
|
|
305
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
306
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
307
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
308
|
+
return addHeapObject(ret);
|
|
309
|
+
}
|
|
310
|
+
export function __wbindgen_cast_0000000000000003(arg0) {
|
|
311
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
312
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
313
|
+
return addHeapObject(ret);
|
|
314
|
+
}
|
|
315
|
+
export function __wbindgen_object_clone_ref(arg0) {
|
|
316
|
+
const ret = getObject(arg0);
|
|
317
|
+
return addHeapObject(ret);
|
|
318
|
+
}
|
|
319
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
320
|
+
takeObject(arg0);
|
|
321
|
+
}
|
|
322
|
+
const SerializableParserResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
323
|
+
? { register: () => {}, unregister: () => {} }
|
|
324
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_serializableparserresult_free(ptr, 1));
|
|
325
|
+
|
|
326
|
+
function addHeapObject(obj) {
|
|
327
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
328
|
+
const idx = heap_next;
|
|
329
|
+
heap_next = heap[idx];
|
|
330
|
+
|
|
331
|
+
heap[idx] = obj;
|
|
332
|
+
return idx;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function debugString(val) {
|
|
336
|
+
// primitive types
|
|
337
|
+
const type = typeof val;
|
|
338
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
339
|
+
return `${val}`;
|
|
340
|
+
}
|
|
341
|
+
if (type == 'string') {
|
|
342
|
+
return `"${val}"`;
|
|
343
|
+
}
|
|
344
|
+
if (type == 'symbol') {
|
|
345
|
+
const description = val.description;
|
|
346
|
+
if (description == null) {
|
|
347
|
+
return 'Symbol';
|
|
348
|
+
} else {
|
|
349
|
+
return `Symbol(${description})`;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (type == 'function') {
|
|
353
|
+
const name = val.name;
|
|
354
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
355
|
+
return `Function(${name})`;
|
|
356
|
+
} else {
|
|
357
|
+
return 'Function';
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// objects
|
|
361
|
+
if (Array.isArray(val)) {
|
|
362
|
+
const length = val.length;
|
|
363
|
+
let debug = '[';
|
|
364
|
+
if (length > 0) {
|
|
365
|
+
debug += debugString(val[0]);
|
|
366
|
+
}
|
|
367
|
+
for(let i = 1; i < length; i++) {
|
|
368
|
+
debug += ', ' + debugString(val[i]);
|
|
369
|
+
}
|
|
370
|
+
debug += ']';
|
|
371
|
+
return debug;
|
|
372
|
+
}
|
|
373
|
+
// Test for built-in
|
|
374
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
375
|
+
let className;
|
|
376
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
377
|
+
className = builtInMatches[1];
|
|
378
|
+
} else {
|
|
379
|
+
// Failed to match the standard '[object ClassName]'
|
|
380
|
+
return toString.call(val);
|
|
381
|
+
}
|
|
382
|
+
if (className == 'Object') {
|
|
383
|
+
// we're a user defined class or Object
|
|
384
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
385
|
+
// easier than looping through ownProperties of `val`.
|
|
386
|
+
try {
|
|
387
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
388
|
+
} catch (_) {
|
|
389
|
+
return 'Object';
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// errors
|
|
393
|
+
if (val instanceof Error) {
|
|
394
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
395
|
+
}
|
|
396
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
397
|
+
return className;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function dropObject(idx) {
|
|
401
|
+
if (idx < 1028) return;
|
|
402
|
+
heap[idx] = heap_next;
|
|
403
|
+
heap_next = idx;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
407
|
+
ptr = ptr >>> 0;
|
|
408
|
+
const mem = getDataViewMemory0();
|
|
409
|
+
const result = [];
|
|
410
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
411
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
412
|
+
}
|
|
413
|
+
return result;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
417
|
+
ptr = ptr >>> 0;
|
|
418
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
let cachedDataViewMemory0 = null;
|
|
422
|
+
function getDataViewMemory0() {
|
|
423
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
424
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
425
|
+
}
|
|
426
|
+
return cachedDataViewMemory0;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function getStringFromWasm0(ptr, len) {
|
|
430
|
+
return decodeText(ptr >>> 0, len);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let cachedUint8ArrayMemory0 = null;
|
|
434
|
+
function getUint8ArrayMemory0() {
|
|
435
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
436
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
437
|
+
}
|
|
438
|
+
return cachedUint8ArrayMemory0;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function getObject(idx) { return heap[idx]; }
|
|
442
|
+
|
|
443
|
+
let heap = new Array(1024).fill(undefined);
|
|
444
|
+
heap.push(undefined, null, true, false);
|
|
445
|
+
|
|
446
|
+
let heap_next = heap.length;
|
|
447
|
+
|
|
448
|
+
function isLikeNone(x) {
|
|
449
|
+
return x === undefined || x === null;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
453
|
+
if (realloc === undefined) {
|
|
454
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
455
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
456
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
457
|
+
WASM_VECTOR_LEN = buf.length;
|
|
458
|
+
return ptr;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
let len = arg.length;
|
|
462
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
463
|
+
|
|
464
|
+
const mem = getUint8ArrayMemory0();
|
|
465
|
+
|
|
466
|
+
let offset = 0;
|
|
467
|
+
|
|
468
|
+
for (; offset < len; offset++) {
|
|
469
|
+
const code = arg.charCodeAt(offset);
|
|
470
|
+
if (code > 0x7F) break;
|
|
471
|
+
mem[ptr + offset] = code;
|
|
472
|
+
}
|
|
473
|
+
if (offset !== len) {
|
|
474
|
+
if (offset !== 0) {
|
|
475
|
+
arg = arg.slice(offset);
|
|
476
|
+
}
|
|
477
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
478
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
479
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
480
|
+
|
|
481
|
+
offset += ret.written;
|
|
482
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
WASM_VECTOR_LEN = offset;
|
|
486
|
+
return ptr;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function takeObject(idx) {
|
|
490
|
+
const ret = getObject(idx);
|
|
491
|
+
dropObject(idx);
|
|
492
|
+
return ret;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
496
|
+
cachedTextDecoder.decode();
|
|
497
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
498
|
+
let numBytesDecoded = 0;
|
|
499
|
+
function decodeText(ptr, len) {
|
|
500
|
+
numBytesDecoded += len;
|
|
501
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
502
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
503
|
+
cachedTextDecoder.decode();
|
|
504
|
+
numBytesDecoded = len;
|
|
505
|
+
}
|
|
506
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
const cachedTextEncoder = new TextEncoder();
|
|
510
|
+
|
|
511
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
512
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
513
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
514
|
+
view.set(buf);
|
|
515
|
+
return {
|
|
516
|
+
read: arg.length,
|
|
517
|
+
written: buf.length
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
let WASM_VECTOR_LEN = 0;
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
let wasm;
|
|
526
|
+
export function __wbg_set_wasm(val) {
|
|
527
|
+
wasm = val;
|
|
528
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_serializableparserresult_free: (a: number, b: number) => void;
|
|
5
|
+
export const format: (a: number, b: number, c: number, d: number) => void;
|
|
6
|
+
export const lex: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const main: () => void;
|
|
8
|
+
export const minify: (a: number, b: number, c: number) => void;
|
|
9
|
+
export const parse: (a: number, b: number, c: number) => void;
|
|
10
|
+
export const parse_error_report: (a: number, b: number, c: number) => void;
|
|
11
|
+
export const serializableparserresult_ast: (a: number) => number;
|
|
12
|
+
export const serializableparserresult_diagnostics: (a: number, b: number) => void;
|
|
13
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
14
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
15
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
16
|
+
export const __wbindgen_export3: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const __wbindgen_start: () => void;
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_serializableparserresult_free: (a: number, b: number) => void;
|
|
5
|
+
export const format: (a: number, b: number, c: number, d: number) => void;
|
|
6
|
+
export const lex: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const main: () => void;
|
|
8
|
+
export const minify: (a: number, b: number, c: number) => void;
|
|
9
|
+
export const parse: (a: number, b: number, c: number) => void;
|
|
10
|
+
export const parse_error_report: (a: number, b: number, c: number) => void;
|
|
11
|
+
export const serializableparserresult_ast: (a: number) => number;
|
|
12
|
+
export const serializableparserresult_diagnostics: (a: number, b: number) => void;
|
|
13
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
14
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
15
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
16
|
+
export const __wbindgen_export3: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const __wbindgen_start: () => void;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class SerializableParserResult {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
readonly ast: any;
|
|
9
|
+
readonly diagnostics: any[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function format(source_text: string, options: any): string;
|
|
13
|
+
|
|
14
|
+
export function lex(source_text: string): any;
|
|
15
|
+
|
|
16
|
+
export function main(): void;
|
|
17
|
+
|
|
18
|
+
export function minify(source_text: string): string;
|
|
19
|
+
|
|
20
|
+
export function parse(source_text: string): SerializableParserResult;
|
|
21
|
+
|
|
22
|
+
export function parse_error_report(source_text: string): string;
|
package/index.js
ADDED
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
/* @ts-self-types="./csskit_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
class SerializableParserResult {
|
|
4
|
+
static __wrap(ptr) {
|
|
5
|
+
const obj = Object.create(SerializableParserResult.prototype);
|
|
6
|
+
obj.__wbg_ptr = ptr;
|
|
7
|
+
SerializableParserResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
8
|
+
return obj;
|
|
9
|
+
}
|
|
10
|
+
__destroy_into_raw() {
|
|
11
|
+
const ptr = this.__wbg_ptr;
|
|
12
|
+
this.__wbg_ptr = 0;
|
|
13
|
+
SerializableParserResultFinalization.unregister(this);
|
|
14
|
+
return ptr;
|
|
15
|
+
}
|
|
16
|
+
free() {
|
|
17
|
+
const ptr = this.__destroy_into_raw();
|
|
18
|
+
wasm.__wbg_serializableparserresult_free(ptr, 0);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @returns {any}
|
|
22
|
+
*/
|
|
23
|
+
get ast() {
|
|
24
|
+
const ret = wasm.serializableparserresult_ast(this.__wbg_ptr);
|
|
25
|
+
return takeObject(ret);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @returns {any[]}
|
|
29
|
+
*/
|
|
30
|
+
get diagnostics() {
|
|
31
|
+
try {
|
|
32
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
33
|
+
wasm.serializableparserresult_diagnostics(retptr, this.__wbg_ptr);
|
|
34
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
35
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
36
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
37
|
+
wasm.__wbindgen_export3(r0, r1 * 4, 4);
|
|
38
|
+
return v1;
|
|
39
|
+
} finally {
|
|
40
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (Symbol.dispose) SerializableParserResult.prototype[Symbol.dispose] = SerializableParserResult.prototype.free;
|
|
45
|
+
exports.SerializableParserResult = SerializableParserResult;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} source_text
|
|
49
|
+
* @param {any} options
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
function format(source_text, options) {
|
|
53
|
+
let deferred3_0;
|
|
54
|
+
let deferred3_1;
|
|
55
|
+
try {
|
|
56
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
57
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
58
|
+
const len0 = WASM_VECTOR_LEN;
|
|
59
|
+
wasm.format(retptr, ptr0, len0, addHeapObject(options));
|
|
60
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
61
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
62
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
63
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
64
|
+
var ptr2 = r0;
|
|
65
|
+
var len2 = r1;
|
|
66
|
+
if (r3) {
|
|
67
|
+
ptr2 = 0; len2 = 0;
|
|
68
|
+
throw takeObject(r2);
|
|
69
|
+
}
|
|
70
|
+
deferred3_0 = ptr2;
|
|
71
|
+
deferred3_1 = len2;
|
|
72
|
+
return getStringFromWasm0(ptr2, len2);
|
|
73
|
+
} finally {
|
|
74
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
75
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.format = format;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @param {string} source_text
|
|
82
|
+
* @returns {any}
|
|
83
|
+
*/
|
|
84
|
+
function lex(source_text) {
|
|
85
|
+
try {
|
|
86
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
87
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
88
|
+
const len0 = WASM_VECTOR_LEN;
|
|
89
|
+
wasm.lex(retptr, ptr0, len0);
|
|
90
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
91
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
92
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
93
|
+
if (r2) {
|
|
94
|
+
throw takeObject(r1);
|
|
95
|
+
}
|
|
96
|
+
return takeObject(r0);
|
|
97
|
+
} finally {
|
|
98
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.lex = lex;
|
|
102
|
+
|
|
103
|
+
function main() {
|
|
104
|
+
wasm.main();
|
|
105
|
+
}
|
|
106
|
+
exports.main = main;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @param {string} source_text
|
|
110
|
+
* @returns {string}
|
|
111
|
+
*/
|
|
112
|
+
function minify(source_text) {
|
|
113
|
+
let deferred3_0;
|
|
114
|
+
let deferred3_1;
|
|
115
|
+
try {
|
|
116
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
117
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
118
|
+
const len0 = WASM_VECTOR_LEN;
|
|
119
|
+
wasm.minify(retptr, ptr0, len0);
|
|
120
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
121
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
122
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
123
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
124
|
+
var ptr2 = r0;
|
|
125
|
+
var len2 = r1;
|
|
126
|
+
if (r3) {
|
|
127
|
+
ptr2 = 0; len2 = 0;
|
|
128
|
+
throw takeObject(r2);
|
|
129
|
+
}
|
|
130
|
+
deferred3_0 = ptr2;
|
|
131
|
+
deferred3_1 = len2;
|
|
132
|
+
return getStringFromWasm0(ptr2, len2);
|
|
133
|
+
} finally {
|
|
134
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
135
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.minify = minify;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @param {string} source_text
|
|
142
|
+
* @returns {SerializableParserResult}
|
|
143
|
+
*/
|
|
144
|
+
function parse(source_text) {
|
|
145
|
+
try {
|
|
146
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
147
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
148
|
+
const len0 = WASM_VECTOR_LEN;
|
|
149
|
+
wasm.parse(retptr, ptr0, len0);
|
|
150
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
151
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
152
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
153
|
+
if (r2) {
|
|
154
|
+
throw takeObject(r1);
|
|
155
|
+
}
|
|
156
|
+
return SerializableParserResult.__wrap(r0);
|
|
157
|
+
} finally {
|
|
158
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.parse = parse;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @param {string} source_text
|
|
165
|
+
* @returns {string}
|
|
166
|
+
*/
|
|
167
|
+
function parse_error_report(source_text) {
|
|
168
|
+
let deferred2_0;
|
|
169
|
+
let deferred2_1;
|
|
170
|
+
try {
|
|
171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
172
|
+
const ptr0 = passStringToWasm0(source_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
173
|
+
const len0 = WASM_VECTOR_LEN;
|
|
174
|
+
wasm.parse_error_report(retptr, ptr0, len0);
|
|
175
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
176
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
177
|
+
deferred2_0 = r0;
|
|
178
|
+
deferred2_1 = r1;
|
|
179
|
+
return getStringFromWasm0(r0, r1);
|
|
180
|
+
} finally {
|
|
181
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
182
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.parse_error_report = parse_error_report;
|
|
186
|
+
function __wbg_get_imports() {
|
|
187
|
+
const import0 = {
|
|
188
|
+
__proto__: null,
|
|
189
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
190
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
191
|
+
return addHeapObject(ret);
|
|
192
|
+
},
|
|
193
|
+
__wbg_Number_6b506e6536831eaa: function(arg0) {
|
|
194
|
+
const ret = Number(getObject(arg0));
|
|
195
|
+
return ret;
|
|
196
|
+
},
|
|
197
|
+
__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
|
|
198
|
+
const v = getObject(arg0);
|
|
199
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
200
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
201
|
+
},
|
|
202
|
+
__wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
|
|
203
|
+
const ret = debugString(getObject(arg1));
|
|
204
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
205
|
+
const len1 = WASM_VECTOR_LEN;
|
|
206
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
207
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
208
|
+
},
|
|
209
|
+
__wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
|
|
210
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
211
|
+
return ret;
|
|
212
|
+
},
|
|
213
|
+
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
214
|
+
const val = getObject(arg0);
|
|
215
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
216
|
+
return ret;
|
|
217
|
+
},
|
|
218
|
+
__wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
|
|
219
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
220
|
+
return ret;
|
|
221
|
+
},
|
|
222
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
223
|
+
const ret = getObject(arg0) === undefined;
|
|
224
|
+
return ret;
|
|
225
|
+
},
|
|
226
|
+
__wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
|
|
227
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
228
|
+
return ret;
|
|
229
|
+
},
|
|
230
|
+
__wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
|
|
231
|
+
const obj = getObject(arg1);
|
|
232
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
233
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
234
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
235
|
+
},
|
|
236
|
+
__wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
|
|
237
|
+
const obj = getObject(arg1);
|
|
238
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
239
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
240
|
+
var len1 = WASM_VECTOR_LEN;
|
|
241
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
242
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
243
|
+
},
|
|
244
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
245
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
246
|
+
},
|
|
247
|
+
__wbg_entries_04b37a02507f1713: function(arg0) {
|
|
248
|
+
const ret = Object.entries(getObject(arg0));
|
|
249
|
+
return addHeapObject(ret);
|
|
250
|
+
},
|
|
251
|
+
__wbg_get_2b48c7d0d006a781: function(arg0, arg1) {
|
|
252
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
253
|
+
return addHeapObject(ret);
|
|
254
|
+
},
|
|
255
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
256
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
257
|
+
return addHeapObject(ret);
|
|
258
|
+
},
|
|
259
|
+
__wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
|
|
260
|
+
let result;
|
|
261
|
+
try {
|
|
262
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
263
|
+
} catch (_) {
|
|
264
|
+
result = false;
|
|
265
|
+
}
|
|
266
|
+
const ret = result;
|
|
267
|
+
return ret;
|
|
268
|
+
},
|
|
269
|
+
__wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
|
|
270
|
+
let result;
|
|
271
|
+
try {
|
|
272
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
273
|
+
} catch (_) {
|
|
274
|
+
result = false;
|
|
275
|
+
}
|
|
276
|
+
const ret = result;
|
|
277
|
+
return ret;
|
|
278
|
+
},
|
|
279
|
+
__wbg_isSafeInteger_66acec27e09e99a7: function(arg0) {
|
|
280
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
281
|
+
return ret;
|
|
282
|
+
},
|
|
283
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
284
|
+
const ret = getObject(arg0).length;
|
|
285
|
+
return ret;
|
|
286
|
+
},
|
|
287
|
+
__wbg_length_66f1a4b2e9026940: function(arg0) {
|
|
288
|
+
const ret = getObject(arg0).length;
|
|
289
|
+
return ret;
|
|
290
|
+
},
|
|
291
|
+
__wbg_new_578aeef4b6b94378: function(arg0) {
|
|
292
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
293
|
+
return addHeapObject(ret);
|
|
294
|
+
},
|
|
295
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
296
|
+
const ret = new Object();
|
|
297
|
+
return addHeapObject(ret);
|
|
298
|
+
},
|
|
299
|
+
__wbg_new_d90091b82fdf5b91: function() {
|
|
300
|
+
const ret = new Array();
|
|
301
|
+
return addHeapObject(ret);
|
|
302
|
+
},
|
|
303
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
304
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
305
|
+
},
|
|
306
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
307
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
308
|
+
},
|
|
309
|
+
__wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
|
|
310
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
311
|
+
},
|
|
312
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
313
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
314
|
+
const ret = arg0;
|
|
315
|
+
return addHeapObject(ret);
|
|
316
|
+
},
|
|
317
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
318
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
319
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
320
|
+
return addHeapObject(ret);
|
|
321
|
+
},
|
|
322
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
323
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
324
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
325
|
+
return addHeapObject(ret);
|
|
326
|
+
},
|
|
327
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
328
|
+
const ret = getObject(arg0);
|
|
329
|
+
return addHeapObject(ret);
|
|
330
|
+
},
|
|
331
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
332
|
+
takeObject(arg0);
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
return {
|
|
336
|
+
__proto__: null,
|
|
337
|
+
"./csskit_wasm_bg.js": import0,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const SerializableParserResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
342
|
+
? { register: () => {}, unregister: () => {} }
|
|
343
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_serializableparserresult_free(ptr, 1));
|
|
344
|
+
|
|
345
|
+
function addHeapObject(obj) {
|
|
346
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
347
|
+
const idx = heap_next;
|
|
348
|
+
heap_next = heap[idx];
|
|
349
|
+
|
|
350
|
+
heap[idx] = obj;
|
|
351
|
+
return idx;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function debugString(val) {
|
|
355
|
+
// primitive types
|
|
356
|
+
const type = typeof val;
|
|
357
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
358
|
+
return `${val}`;
|
|
359
|
+
}
|
|
360
|
+
if (type == 'string') {
|
|
361
|
+
return `"${val}"`;
|
|
362
|
+
}
|
|
363
|
+
if (type == 'symbol') {
|
|
364
|
+
const description = val.description;
|
|
365
|
+
if (description == null) {
|
|
366
|
+
return 'Symbol';
|
|
367
|
+
} else {
|
|
368
|
+
return `Symbol(${description})`;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (type == 'function') {
|
|
372
|
+
const name = val.name;
|
|
373
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
374
|
+
return `Function(${name})`;
|
|
375
|
+
} else {
|
|
376
|
+
return 'Function';
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// objects
|
|
380
|
+
if (Array.isArray(val)) {
|
|
381
|
+
const length = val.length;
|
|
382
|
+
let debug = '[';
|
|
383
|
+
if (length > 0) {
|
|
384
|
+
debug += debugString(val[0]);
|
|
385
|
+
}
|
|
386
|
+
for(let i = 1; i < length; i++) {
|
|
387
|
+
debug += ', ' + debugString(val[i]);
|
|
388
|
+
}
|
|
389
|
+
debug += ']';
|
|
390
|
+
return debug;
|
|
391
|
+
}
|
|
392
|
+
// Test for built-in
|
|
393
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
394
|
+
let className;
|
|
395
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
396
|
+
className = builtInMatches[1];
|
|
397
|
+
} else {
|
|
398
|
+
// Failed to match the standard '[object ClassName]'
|
|
399
|
+
return toString.call(val);
|
|
400
|
+
}
|
|
401
|
+
if (className == 'Object') {
|
|
402
|
+
// we're a user defined class or Object
|
|
403
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
404
|
+
// easier than looping through ownProperties of `val`.
|
|
405
|
+
try {
|
|
406
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
407
|
+
} catch (_) {
|
|
408
|
+
return 'Object';
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
// errors
|
|
412
|
+
if (val instanceof Error) {
|
|
413
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
414
|
+
}
|
|
415
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
416
|
+
return className;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function dropObject(idx) {
|
|
420
|
+
if (idx < 1028) return;
|
|
421
|
+
heap[idx] = heap_next;
|
|
422
|
+
heap_next = idx;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
426
|
+
ptr = ptr >>> 0;
|
|
427
|
+
const mem = getDataViewMemory0();
|
|
428
|
+
const result = [];
|
|
429
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
430
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
431
|
+
}
|
|
432
|
+
return result;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
436
|
+
ptr = ptr >>> 0;
|
|
437
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
let cachedDataViewMemory0 = null;
|
|
441
|
+
function getDataViewMemory0() {
|
|
442
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
443
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
444
|
+
}
|
|
445
|
+
return cachedDataViewMemory0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function getStringFromWasm0(ptr, len) {
|
|
449
|
+
return decodeText(ptr >>> 0, len);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
let cachedUint8ArrayMemory0 = null;
|
|
453
|
+
function getUint8ArrayMemory0() {
|
|
454
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
455
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
456
|
+
}
|
|
457
|
+
return cachedUint8ArrayMemory0;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function getObject(idx) { return heap[idx]; }
|
|
461
|
+
|
|
462
|
+
let heap = new Array(1024).fill(undefined);
|
|
463
|
+
heap.push(undefined, null, true, false);
|
|
464
|
+
|
|
465
|
+
let heap_next = heap.length;
|
|
466
|
+
|
|
467
|
+
function isLikeNone(x) {
|
|
468
|
+
return x === undefined || x === null;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
472
|
+
if (realloc === undefined) {
|
|
473
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
474
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
475
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
476
|
+
WASM_VECTOR_LEN = buf.length;
|
|
477
|
+
return ptr;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
let len = arg.length;
|
|
481
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
482
|
+
|
|
483
|
+
const mem = getUint8ArrayMemory0();
|
|
484
|
+
|
|
485
|
+
let offset = 0;
|
|
486
|
+
|
|
487
|
+
for (; offset < len; offset++) {
|
|
488
|
+
const code = arg.charCodeAt(offset);
|
|
489
|
+
if (code > 0x7F) break;
|
|
490
|
+
mem[ptr + offset] = code;
|
|
491
|
+
}
|
|
492
|
+
if (offset !== len) {
|
|
493
|
+
if (offset !== 0) {
|
|
494
|
+
arg = arg.slice(offset);
|
|
495
|
+
}
|
|
496
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
497
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
498
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
499
|
+
|
|
500
|
+
offset += ret.written;
|
|
501
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
WASM_VECTOR_LEN = offset;
|
|
505
|
+
return ptr;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function takeObject(idx) {
|
|
509
|
+
const ret = getObject(idx);
|
|
510
|
+
dropObject(idx);
|
|
511
|
+
return ret;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
515
|
+
cachedTextDecoder.decode();
|
|
516
|
+
function decodeText(ptr, len) {
|
|
517
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
const cachedTextEncoder = new TextEncoder();
|
|
521
|
+
|
|
522
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
523
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
524
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
525
|
+
view.set(buf);
|
|
526
|
+
return {
|
|
527
|
+
read: arg.length,
|
|
528
|
+
written: buf.length
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
let WASM_VECTOR_LEN = 0;
|
|
534
|
+
|
|
535
|
+
const wasmPath = `${__dirname}/csskit_wasm_bg.wasm`;
|
|
536
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
537
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
538
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
539
|
+
let wasm = wasmInstance.exports;
|
|
540
|
+
wasm.__wbindgen_start();
|
package/package.json
CHANGED
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "csskit",
|
|
3
|
-
"version": "0.0.26
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Refreshing CSS",
|
|
5
5
|
"keywords": [],
|
|
6
|
+
"repository": "https://github.com/csskit/csskit",
|
|
7
|
+
"funding": {
|
|
8
|
+
"url": "https://github.com/sponsors/keithamus"
|
|
9
|
+
},
|
|
6
10
|
"license": "MIT",
|
|
7
11
|
"author": "Keith Cirkel (https://keithcirkel.co.uk)",
|
|
8
|
-
"
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./index.js",
|
|
14
|
+
"./bundler": "./bundle/csskit_wasm.js",
|
|
15
|
+
"./wasm": "./bundle/csskit_wasm_bg.wasm",
|
|
16
|
+
"./bin/csskit": "./bin/csskit"
|
|
17
|
+
},
|
|
18
|
+
"main": "./index.js",
|
|
9
19
|
"bin": "./bin/csskit",
|
|
10
20
|
"files": [
|
|
11
|
-
"./bin"
|
|
21
|
+
"./bin",
|
|
22
|
+
"./index.js",
|
|
23
|
+
"./index.d.ts",
|
|
24
|
+
"./csskit_wasm_bg.wasm",
|
|
25
|
+
"./csskit_wasm_bg.wasm.d.ts",
|
|
26
|
+
"./bundle"
|
|
12
27
|
],
|
|
13
28
|
"optionalDependencies": {
|
|
14
|
-
"csskit-
|
|
15
|
-
"csskit-
|
|
16
|
-
"csskit-
|
|
17
|
-
"csskit-
|
|
18
|
-
"csskit-win32-
|
|
19
|
-
"csskit-win32-
|
|
29
|
+
"csskit-darwin-arm64": "0.0.26",
|
|
30
|
+
"csskit-darwin-x64": "0.0.26",
|
|
31
|
+
"csskit-linux-arm64": "0.0.26",
|
|
32
|
+
"csskit-linux-x64": "0.0.26",
|
|
33
|
+
"csskit-win32-arm64": "0.0.26",
|
|
34
|
+
"csskit-win32-x64": "0.0.26"
|
|
20
35
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
36
|
+
"allowScripts": {
|
|
37
|
+
"wasm-opt@1.4.0": true
|
|
23
38
|
}
|
|
24
39
|
}
|