csskit 0.0.30-canary.e2f3d18636 → 0.0.30
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/README.md +50 -3
- package/addon.js +42 -0
- package/bundle/csskit_wasm_bg.wasm +0 -0
- package/bundle/csskit_wasm_node.js +535 -0
- package/bundle.d.ts +32 -0
- package/bundle.js +13 -0
- package/index.d.ts +70 -15
- package/index.js +9 -537
- package/nodes.d.ts +1408 -0
- package/nodes.js +1408 -0
- package/om.js +66 -0
- package/package.json +32 -11
- package/csskit_wasm_bg.wasm +0 -0
- package/csskit_wasm_bg.wasm.d.ts +0 -17
package/index.d.ts
CHANGED
|
@@ -1,22 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
// Type definitions for the csskit object model (`csskit`).
|
|
2
|
+
|
|
3
|
+
import * as nodeClasses from './nodes.js';
|
|
4
|
+
|
|
5
|
+
/** Every node class, one per AST node kind; the same module as `csskit/nodes`. */
|
|
6
|
+
export declare const nodes: typeof nodeClasses;
|
|
7
|
+
|
|
8
|
+
/** A parse diagnostic. */
|
|
9
|
+
export interface Diagnostic {
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
severity: string;
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
help: string;
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A visitor callback. Return `'skip'` or `'skip-children'` to prune the subtree, `'stop'` to end the
|
|
20
|
+
* traversal. All other values descend.
|
|
21
|
+
*/
|
|
22
|
+
export type VisitorCallback = (node: Node) => 'skip' | 'skip-children' | 'stop' | void | unknown;
|
|
13
23
|
|
|
14
|
-
|
|
24
|
+
/**
|
|
25
|
+
* A node in a parsed AST.
|
|
26
|
+
*
|
|
27
|
+
* Each node kind has its own subclass, see `csskit/nodes`. You cannot construct a node from JS: a
|
|
28
|
+
* node comes from `parse` or from a query. The root node owns the parse. All other nodes keep it
|
|
29
|
+
* alive.
|
|
30
|
+
*/
|
|
31
|
+
export declare class Node {
|
|
32
|
+
/** The kebab-case tag of this kind, for example `'style-rule'`. */
|
|
33
|
+
static readonly tag: string;
|
|
34
|
+
/** Parses `source` as this class. A kind with no standalone grammar throws. */
|
|
35
|
+
static parse<T extends typeof Node>(this: T, source: string): InstanceType<T>;
|
|
15
36
|
|
|
16
|
-
|
|
37
|
+
/** The class name of this node, for example `'StyleRule'`. */
|
|
38
|
+
readonly kind: string;
|
|
39
|
+
/** The kebab-case tag of this kind. */
|
|
40
|
+
readonly tag: string;
|
|
41
|
+
/** The kind index in the addon table. Stable within one process only. */
|
|
42
|
+
readonly kindId: number;
|
|
43
|
+
/** The byte offset of the start of this node. */
|
|
44
|
+
readonly start: number;
|
|
45
|
+
/** The byte offset of the end of this node. */
|
|
46
|
+
readonly end: number;
|
|
47
|
+
/** The full source text given to `parse`. */
|
|
48
|
+
readonly source: string;
|
|
49
|
+
/** The source text of this node. */
|
|
50
|
+
readonly text: string;
|
|
51
|
+
/** The diagnostics of the parse. Includes diagnostics from outside this subtree. */
|
|
52
|
+
readonly diagnostics: Diagnostic[];
|
|
17
53
|
|
|
18
|
-
|
|
54
|
+
/** True if this node matches `selector`. */
|
|
55
|
+
matches(selector: string): boolean;
|
|
56
|
+
/** Every descendant that matches `selector`, for example `'style-rule *[name=color]'`. */
|
|
57
|
+
querySelectorAll(selector: string): Node[];
|
|
58
|
+
/** The first descendant that matches `selector`, or `null`. */
|
|
59
|
+
querySelector(selector: string): Node | null;
|
|
60
|
+
/** Runs the Rust visitor over this subtree. Calls `enter` and `exit` for each node. */
|
|
61
|
+
accept(enter?: VisitorCallback, exit?: VisitorCallback): void;
|
|
62
|
+
}
|
|
19
63
|
|
|
20
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Parses `source` as `context`, which defaults to `StyleSheet`.
|
|
66
|
+
*
|
|
67
|
+
* `context` is a node class, not a name: `parse(src, { context: Color })` and `Color.parse(src)` are
|
|
68
|
+
* the same.
|
|
69
|
+
*/
|
|
70
|
+
export declare function parse<T extends Node>(source: string, options: { context: { parse(source: string): T } }): T;
|
|
71
|
+
export declare function parse(source: string, options?: { context?: undefined }): nodeClasses.StyleSheet;
|
|
21
72
|
|
|
22
|
-
export
|
|
73
|
+
export declare const Color: typeof nodeClasses.Color;
|
|
74
|
+
export declare const ComponentValues: typeof nodeClasses.ComponentValues;
|
|
75
|
+
export declare const SelectorList: typeof nodeClasses.SelectorList;
|
|
76
|
+
export declare const StyleRule: typeof nodeClasses.StyleRule;
|
|
77
|
+
export declare const StyleSheet: typeof nodeClasses.StyleSheet;
|
package/index.js
CHANGED
|
@@ -1,540 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
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
|
-
|
|
1
|
+
export * from "./nodes.js";
|
|
2
|
+
export * from "./om.js";
|
|
3
|
+
import { StyleSheet } from "./nodes.js";
|
|
163
4
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
5
|
+
* Parses `source` as `context`, which defaults to `StyleSheet`.
|
|
6
|
+
*
|
|
7
|
+
* `context` is a node class, not a name: `parse(src, { context: Color })` and `Color.parse(src)` are
|
|
8
|
+
* the same.
|
|
166
9
|
*/
|
|
167
|
-
function
|
|
168
|
-
|
|
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_92b29b0548f8b746: function(arg0, arg1) {
|
|
190
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
191
|
-
return addHeapObject(ret);
|
|
192
|
-
},
|
|
193
|
-
__wbg_Number_9a4e0ecb0fa16705: function(arg0) {
|
|
194
|
-
const ret = Number(getObject(arg0));
|
|
195
|
-
return ret;
|
|
196
|
-
},
|
|
197
|
-
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: 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_c25d447a39f5578f: 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_aca499c5de7ff5e5: function(arg0, arg1) {
|
|
210
|
-
const ret = getObject(arg0) in getObject(arg1);
|
|
211
|
-
return ret;
|
|
212
|
-
},
|
|
213
|
-
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
214
|
-
const val = getObject(arg0);
|
|
215
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
216
|
-
return ret;
|
|
217
|
-
},
|
|
218
|
-
__wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
|
|
219
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
220
|
-
return ret;
|
|
221
|
-
},
|
|
222
|
-
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
223
|
-
const ret = getObject(arg0) === undefined;
|
|
224
|
-
return ret;
|
|
225
|
-
},
|
|
226
|
-
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
|
|
227
|
-
const ret = getObject(arg0) == getObject(arg1);
|
|
228
|
-
return ret;
|
|
229
|
-
},
|
|
230
|
-
__wbg___wbindgen_number_get_394265ed1e1b84ee: 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_b0ca35b86a603356: 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_344f42d3211c4765: function(arg0, arg1) {
|
|
245
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
246
|
-
},
|
|
247
|
-
__wbg_entries_015dc610cd81ede0: function(arg0) {
|
|
248
|
-
const ret = Object.entries(getObject(arg0));
|
|
249
|
-
return addHeapObject(ret);
|
|
250
|
-
},
|
|
251
|
-
__wbg_get_507a50627bffa49b: 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_4480b9e0068a8adb: 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_309b927aaf7a3fc7: 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_04f36e4056f1b851: function(arg0) {
|
|
280
|
-
const ret = Number.isSafeInteger(getObject(arg0));
|
|
281
|
-
return ret;
|
|
282
|
-
},
|
|
283
|
-
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
284
|
-
const ret = getObject(arg0).length;
|
|
285
|
-
return ret;
|
|
286
|
-
},
|
|
287
|
-
__wbg_length_370319915dc99107: function(arg0) {
|
|
288
|
-
const ret = getObject(arg0).length;
|
|
289
|
-
return ret;
|
|
290
|
-
},
|
|
291
|
-
__wbg_new_32b398fb48b6d94a: function() {
|
|
292
|
-
const ret = new Array();
|
|
293
|
-
return addHeapObject(ret);
|
|
294
|
-
},
|
|
295
|
-
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
296
|
-
const ret = new Uint8Array(getObject(arg0));
|
|
297
|
-
return addHeapObject(ret);
|
|
298
|
-
},
|
|
299
|
-
__wbg_new_da52cf8fe3429cb2: function() {
|
|
300
|
-
const ret = new Object();
|
|
301
|
-
return addHeapObject(ret);
|
|
302
|
-
},
|
|
303
|
-
__wbg_prototypesetcall_4770620bbe4688a0: 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_8a16b38e4805b298: 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
|
-
};
|
|
10
|
+
export function parse(source, options) {
|
|
11
|
+
return (options?.context ?? StyleSheet).parse(source);
|
|
531
12
|
}
|
|
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();
|