@prospective.co/procss 0.1.17 → 0.1.18

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prospective.co/procss",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "A simple CSS parsing and transformation framework.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -113,7 +113,7 @@ where
113
113
  }
114
114
 
115
115
  /// Parses 1 or more whitespace characters, including comments.
116
- pub fn comment1<'a, E>(input: &'a str) -> IResult<&'_ str, (), E>
116
+ pub fn comment1<'a, E>(input: &'a str) -> IResult<&'a str, (), E>
117
117
  where
118
118
  E: ParseError<&'a str>,
119
119
  {
@@ -125,7 +125,7 @@ where
125
125
  }
126
126
 
127
127
  /// Parses 0 or more whitespace characters, including comments and semicolons.
128
- pub fn sep0<'a, E>(input: &'a str) -> IResult<&'_ str, (), E>
128
+ pub fn sep0<'a, E>(input: &'a str) -> IResult<&'a str, (), E>
129
129
  where
130
130
  E: ParseError<&'a str>,
131
131
  {
package/src/lib.rs CHANGED
@@ -78,7 +78,6 @@
78
78
  //! ```
79
79
 
80
80
  #![feature(assert_matches)]
81
- #![feature(path_file_prefix)]
82
81
 
83
82
  pub mod ast;
84
83
  mod builder;
@@ -12,6 +12,7 @@
12
12
  use std::borrow::Cow;
13
13
  use std::path::Path;
14
14
 
15
+ use base64::prelude::*;
15
16
  use nom::branch::alt;
16
17
  use nom::bytes::complete::{is_not, tag};
17
18
  use nom::sequence::delimited;
@@ -41,8 +42,9 @@ fn read_file_sync(path: &Path) -> Option<Vec<u8>> {
41
42
 
42
43
  fn parse_url(input: &str) -> nom::IResult<&str, &str> {
43
44
  let unquoted = delimited(tag("url("), is_not(")"), tag(")"));
44
- let quoted = delimited(tag("url(\""), is_not("\""), tag("\")"));
45
- alt((quoted, unquoted))(input)
45
+ let dblquoted = delimited(tag("url(\""), is_not("\""), tag("\")"));
46
+ let sglquoted = delimited(tag("url('"), is_not("'"), tag("')"));
47
+ alt((sglquoted, dblquoted, unquoted))(input)
46
48
  }
47
49
 
48
50
  fn into_data_uri<'a>(path: &Path) -> Option<Cow<'a, str>> {
@@ -51,7 +53,7 @@ fn into_data_uri<'a>(path: &Path) -> Option<Cow<'a, str>> {
51
53
  }
52
54
 
53
55
  let contents = read_file_sync(path)?;
54
- let encoded = base64::encode(contents);
56
+ let encoded = BASE64_STANDARD.encode(contents);
55
57
  let fff = path.extension().unwrap_or_default().to_string_lossy();
56
58
  let ggg = path.to_string_lossy();
57
59
  let fmt = match fff.as_ref() {
@@ -1,22 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+
3
4
  /**
4
- * An implementation of `BuildCss` which owns its data, suitable for use as an
5
- * exported type in JavaScript.
6
- */
5
+ * An implementation of `BuildCss` which owns its data, suitable for use as an
6
+ * exported type in JavaScript.
7
+ */
7
8
  export class BuildCss {
8
- free(): void;
9
- /**
10
- * @param {string} rootdir
11
- */
12
- constructor(rootdir: string);
13
- /**
14
- * @param {string} path
15
- * @param {string} content
16
- */
17
- add(path: string, content: string): void;
18
- /**
19
- * @returns {any}
20
- */
21
- compile(): any;
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ add(path: string, content: string): void;
12
+ compile(): any;
13
+ constructor(rootdir: string);
22
14
  }
@@ -1,79 +1,177 @@
1
- let imports = {};
2
- imports['__wbindgen_placeholder__'] = module.exports;
3
- let wasm;
1
+ /* @ts-self-types="./procss.d.ts" */
4
2
  const { readFileSync } = require(`fs`);
5
- const { TextDecoder, TextEncoder } = require(`util`);
6
3
 
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
8
-
9
- cachedTextDecoder.decode();
10
-
11
- let cachedUint8Memory0 = null;
12
-
13
- function getUint8Memory0() {
14
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
15
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
4
+ /**
5
+ * An implementation of `BuildCss` which owns its data, suitable for use as an
6
+ * exported type in JavaScript.
7
+ */
8
+ class BuildCss {
9
+ __destroy_into_raw() {
10
+ const ptr = this.__wbg_ptr;
11
+ this.__wbg_ptr = 0;
12
+ BuildCssFinalization.unregister(this);
13
+ return ptr;
14
+ }
15
+ free() {
16
+ const ptr = this.__destroy_into_raw();
17
+ wasm.__wbg_buildcss_free(ptr, 0);
18
+ }
19
+ /**
20
+ * @param {string} path
21
+ * @param {string} content
22
+ */
23
+ add(path, content) {
24
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
25
+ const len0 = WASM_VECTOR_LEN;
26
+ const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
27
+ const len1 = WASM_VECTOR_LEN;
28
+ wasm.buildcss_add(this.__wbg_ptr, ptr0, len0, ptr1, len1);
29
+ }
30
+ /**
31
+ * @returns {any}
32
+ */
33
+ compile() {
34
+ const ret = wasm.buildcss_compile(this.__wbg_ptr);
35
+ if (ret[2]) {
36
+ throw takeFromExternrefTable0(ret[1]);
37
+ }
38
+ return takeFromExternrefTable0(ret[0]);
39
+ }
40
+ /**
41
+ * @param {string} rootdir
42
+ */
43
+ constructor(rootdir) {
44
+ const ptr0 = passStringToWasm0(rootdir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
45
+ const len0 = WASM_VECTOR_LEN;
46
+ const ret = wasm.buildcss_new(ptr0, len0);
47
+ this.__wbg_ptr = ret >>> 0;
48
+ BuildCssFinalization.register(this, this.__wbg_ptr, this);
49
+ return this;
16
50
  }
17
- return cachedUint8Memory0;
18
51
  }
19
-
20
- function getStringFromWasm0(ptr, len) {
21
- ptr = ptr >>> 0;
22
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
52
+ if (Symbol.dispose) BuildCss.prototype[Symbol.dispose] = BuildCss.prototype.free;
53
+ exports.BuildCss = BuildCss;
54
+
55
+ function __wbg_get_imports() {
56
+ const import0 = {
57
+ __proto__: null,
58
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
59
+ const ret = Error(getStringFromWasm0(arg0, arg1));
60
+ return ret;
61
+ },
62
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
63
+ throw new Error(getStringFromWasm0(arg0, arg1));
64
+ },
65
+ __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
66
+ let deferred0_0;
67
+ let deferred0_1;
68
+ try {
69
+ deferred0_0 = arg0;
70
+ deferred0_1 = arg1;
71
+ console.error(getStringFromWasm0(arg0, arg1));
72
+ } finally {
73
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
74
+ }
75
+ },
76
+ __wbg_new_8a6f238a6ece86ea: function() {
77
+ const ret = new Error();
78
+ return ret;
79
+ },
80
+ __wbg_new_dca287b076112a51: function() {
81
+ const ret = new Map();
82
+ return ret;
83
+ },
84
+ __wbg_readFileSync_1f0dbe90bd0ee621: function() { return handleError(function (arg0, arg1, arg2) {
85
+ const ret = readFileSync(getStringFromWasm0(arg1, arg2));
86
+ const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
87
+ const len1 = WASM_VECTOR_LEN;
88
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
89
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
90
+ }, arguments); },
91
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
92
+ const ret = arg0.set(arg1, arg2);
93
+ return ret;
94
+ },
95
+ __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
96
+ const ret = arg1.stack;
97
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
98
+ const len1 = WASM_VECTOR_LEN;
99
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
100
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
101
+ },
102
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
103
+ // Cast intrinsic for `Ref(String) -> Externref`.
104
+ const ret = getStringFromWasm0(arg0, arg1);
105
+ return ret;
106
+ },
107
+ __wbindgen_init_externref_table: function() {
108
+ const table = wasm.__wbindgen_externrefs;
109
+ const offset = table.grow(4);
110
+ table.set(0, undefined);
111
+ table.set(offset + 0, undefined);
112
+ table.set(offset + 1, null);
113
+ table.set(offset + 2, true);
114
+ table.set(offset + 3, false);
115
+ },
116
+ };
117
+ return {
118
+ __proto__: null,
119
+ "./procss_bg.js": import0,
120
+ };
23
121
  }
24
122
 
25
- const heap = new Array(128).fill(undefined);
26
-
27
- heap.push(undefined, null, true, false);
28
-
29
- let heap_next = heap.length;
123
+ const BuildCssFinalization = (typeof FinalizationRegistry === 'undefined')
124
+ ? { register: () => {}, unregister: () => {} }
125
+ : new FinalizationRegistry(ptr => wasm.__wbg_buildcss_free(ptr >>> 0, 1));
30
126
 
31
- function addHeapObject(obj) {
32
- if (heap_next === heap.length) heap.push(heap.length + 1);
33
- const idx = heap_next;
34
- heap_next = heap[idx];
35
-
36
- heap[idx] = obj;
127
+ function addToExternrefTable0(obj) {
128
+ const idx = wasm.__externref_table_alloc();
129
+ wasm.__wbindgen_externrefs.set(idx, obj);
37
130
  return idx;
38
131
  }
39
132
 
40
- function getObject(idx) { return heap[idx]; }
41
-
42
- function dropObject(idx) {
43
- if (idx < 132) return;
44
- heap[idx] = heap_next;
45
- heap_next = idx;
133
+ let cachedDataViewMemory0 = null;
134
+ function getDataViewMemory0() {
135
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
136
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
137
+ }
138
+ return cachedDataViewMemory0;
46
139
  }
47
140
 
48
- function takeObject(idx) {
49
- const ret = getObject(idx);
50
- dropObject(idx);
51
- return ret;
141
+ function getStringFromWasm0(ptr, len) {
142
+ ptr = ptr >>> 0;
143
+ return decodeText(ptr, len);
52
144
  }
53
145
 
54
- let WASM_VECTOR_LEN = 0;
146
+ let cachedUint8ArrayMemory0 = null;
147
+ function getUint8ArrayMemory0() {
148
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
149
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
150
+ }
151
+ return cachedUint8ArrayMemory0;
152
+ }
55
153
 
56
- let cachedTextEncoder = new TextEncoder('utf-8');
154
+ function handleError(f, args) {
155
+ try {
156
+ return f.apply(this, args);
157
+ } catch (e) {
158
+ const idx = addToExternrefTable0(e);
159
+ wasm.__wbindgen_exn_store(idx);
160
+ }
161
+ }
57
162
 
58
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
59
- ? function (arg, view) {
60
- return cachedTextEncoder.encodeInto(arg, view);
163
+ function passArray8ToWasm0(arg, malloc) {
164
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
165
+ getUint8ArrayMemory0().set(arg, ptr / 1);
166
+ WASM_VECTOR_LEN = arg.length;
167
+ return ptr;
61
168
  }
62
- : function (arg, view) {
63
- const buf = cachedTextEncoder.encode(arg);
64
- view.set(buf);
65
- return {
66
- read: arg.length,
67
- written: buf.length
68
- };
69
- });
70
169
 
71
170
  function passStringToWasm0(arg, malloc, realloc) {
72
-
73
171
  if (realloc === undefined) {
74
172
  const buf = cachedTextEncoder.encode(arg);
75
173
  const ptr = malloc(buf.length, 1) >>> 0;
76
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
174
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
77
175
  WASM_VECTOR_LEN = buf.length;
78
176
  return ptr;
79
177
  }
@@ -81,7 +179,7 @@ function passStringToWasm0(arg, malloc, realloc) {
81
179
  let len = arg.length;
82
180
  let ptr = malloc(len, 1) >>> 0;
83
181
 
84
- const mem = getUint8Memory0();
182
+ const mem = getUint8ArrayMemory0();
85
183
 
86
184
  let offset = 0;
87
185
 
@@ -90,194 +188,51 @@ function passStringToWasm0(arg, malloc, realloc) {
90
188
  if (code > 0x7F) break;
91
189
  mem[ptr + offset] = code;
92
190
  }
93
-
94
191
  if (offset !== len) {
95
192
  if (offset !== 0) {
96
193
  arg = arg.slice(offset);
97
194
  }
98
195
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
99
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
100
- const ret = encodeString(arg, view);
196
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
197
+ const ret = cachedTextEncoder.encodeInto(arg, view);
101
198
 
102
199
  offset += ret.written;
200
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
103
201
  }
104
202
 
105
203
  WASM_VECTOR_LEN = offset;
106
204
  return ptr;
107
205
  }
108
206
 
109
- let cachedInt32Memory0 = null;
110
-
111
- function getInt32Memory0() {
112
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
113
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
114
- }
115
- return cachedInt32Memory0;
207
+ function takeFromExternrefTable0(idx) {
208
+ const value = wasm.__wbindgen_externrefs.get(idx);
209
+ wasm.__externref_table_dealloc(idx);
210
+ return value;
116
211
  }
117
212
 
118
- function passArray8ToWasm0(arg, malloc) {
119
- const ptr = malloc(arg.length * 1, 1) >>> 0;
120
- getUint8Memory0().set(arg, ptr / 1);
121
- WASM_VECTOR_LEN = arg.length;
122
- return ptr;
213
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
214
+ cachedTextDecoder.decode();
215
+ function decodeText(ptr, len) {
216
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
123
217
  }
124
218
 
125
- function handleError(f, args) {
126
- try {
127
- return f.apply(this, args);
128
- } catch (e) {
129
- wasm.__wbindgen_exn_store(addHeapObject(e));
130
- }
131
- }
132
- /**
133
- * An implementation of `BuildCss` which owns its data, suitable for use as an
134
- * exported type in JavaScript.
135
- */
136
- class BuildCss {
219
+ const cachedTextEncoder = new TextEncoder();
137
220
 
138
- __destroy_into_raw() {
139
- const ptr = this.__wbg_ptr;
140
- this.__wbg_ptr = 0;
141
-
142
- return ptr;
143
- }
144
-
145
- free() {
146
- const ptr = this.__destroy_into_raw();
147
- wasm.__wbg_buildcss_free(ptr);
148
- }
149
- /**
150
- * @param {string} rootdir
151
- */
152
- constructor(rootdir) {
153
- const ptr0 = passStringToWasm0(rootdir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
154
- const len0 = WASM_VECTOR_LEN;
155
- const ret = wasm.buildcss_new(ptr0, len0);
156
- this.__wbg_ptr = ret >>> 0;
157
- return this;
158
- }
159
- /**
160
- * @param {string} path
161
- * @param {string} content
162
- */
163
- add(path, content) {
164
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
165
- const len0 = WASM_VECTOR_LEN;
166
- const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
167
- const len1 = WASM_VECTOR_LEN;
168
- wasm.buildcss_add(this.__wbg_ptr, ptr0, len0, ptr1, len1);
169
- }
170
- /**
171
- * @returns {any}
172
- */
173
- compile() {
174
- try {
175
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
176
- wasm.buildcss_compile(retptr, this.__wbg_ptr);
177
- var r0 = getInt32Memory0()[retptr / 4 + 0];
178
- var r1 = getInt32Memory0()[retptr / 4 + 1];
179
- var r2 = getInt32Memory0()[retptr / 4 + 2];
180
- if (r2) {
181
- throw takeObject(r1);
182
- }
183
- return takeObject(r0);
184
- } finally {
185
- wasm.__wbindgen_add_to_stack_pointer(16);
186
- }
187
- }
221
+ if (!('encodeInto' in cachedTextEncoder)) {
222
+ cachedTextEncoder.encodeInto = function (arg, view) {
223
+ const buf = cachedTextEncoder.encode(arg);
224
+ view.set(buf);
225
+ return {
226
+ read: arg.length,
227
+ written: buf.length
228
+ };
229
+ };
188
230
  }
189
- module.exports.BuildCss = BuildCss;
190
-
191
- module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
192
- let deferred0_0;
193
- let deferred0_1;
194
- try {
195
- deferred0_0 = arg0;
196
- deferred0_1 = arg1;
197
- console.error(getStringFromWasm0(arg0, arg1));
198
- } finally {
199
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
200
- }
201
- };
202
231
 
203
- module.exports.__wbg_new_abda76e883ba8a5f = function() {
204
- const ret = new Error();
205
- return addHeapObject(ret);
206
- };
207
-
208
- module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
209
- const ret = getObject(arg1).stack;
210
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
211
- const len1 = WASM_VECTOR_LEN;
212
- getInt32Memory0()[arg0 / 4 + 1] = len1;
213
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
214
- };
215
-
216
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
217
- const ret = getStringFromWasm0(arg0, arg1);
218
- return addHeapObject(ret);
219
- };
220
-
221
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
222
- takeObject(arg0);
223
- };
224
-
225
- module.exports.__wbindgen_throw = function(arg0, arg1) {
226
- throw new Error(getStringFromWasm0(arg0, arg1));
227
- };
228
-
229
- module.exports.__wbindgen_is_string = function(arg0) {
230
- const ret = typeof(getObject(arg0)) === 'string';
231
- return ret;
232
- };
233
-
234
- module.exports.__wbg_new_1b94180eeb48f2a2 = function() {
235
- const ret = new Map();
236
- return addHeapObject(ret);
237
- };
238
-
239
- module.exports.__wbg_set_3355b9f2d3092e3b = function(arg0, arg1, arg2) {
240
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
241
- return addHeapObject(ret);
242
- };
243
-
244
- module.exports.__wbg_new_c728d68b8b34487e = function() {
245
- const ret = new Object();
246
- return addHeapObject(ret);
247
- };
248
-
249
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
250
- const ret = new Error(getStringFromWasm0(arg0, arg1));
251
- return addHeapObject(ret);
252
- };
253
-
254
- module.exports.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
255
- const ret = String(getObject(arg1));
256
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
- const len1 = WASM_VECTOR_LEN;
258
- getInt32Memory0()[arg0 / 4 + 1] = len1;
259
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
260
- };
261
-
262
- module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
263
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
264
- };
265
-
266
- module.exports.__wbg_readFileSync_74d9a0fda9d26176 = function() { return handleError(function (arg0, arg1, arg2) {
267
- const ret = readFileSync(getStringFromWasm0(arg1, arg2));
268
- const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
269
- const len1 = WASM_VECTOR_LEN;
270
- getInt32Memory0()[arg0 / 4 + 1] = len1;
271
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
272
- }, arguments) };
273
-
274
- const path = require('path').join(__dirname, 'procss_bg.wasm');
275
- const bytes = require('fs').readFileSync(path);
276
-
277
- const wasmModule = new WebAssembly.Module(bytes);
278
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
279
- wasm = wasmInstance.exports;
280
- module.exports.__wasm = wasm;
232
+ let WASM_VECTOR_LEN = 0;
281
233
 
234
+ const wasmPath = `${__dirname}/procss_bg.wasm`;
235
+ const wasmBytes = require('fs').readFileSync(wasmPath);
236
+ const wasmModule = new WebAssembly.Module(wasmBytes);
237
+ const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
282
238
  wasm.__wbindgen_start();
283
-
Binary file
@@ -1,14 +1,16 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function main(a: number, b: number): number;
5
- export function __wbg_buildcss_free(a: number): void;
6
- export function buildcss_new(a: number, b: number): number;
7
- export function buildcss_add(a: number, b: number, c: number, d: number, e: number): void;
8
- export function buildcss_compile(a: number, b: number): void;
9
- export function __wbindgen_free(a: number, b: number, c: number): void;
10
- export function __wbindgen_malloc(a: number, b: number): number;
11
- export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
12
- export function __wbindgen_add_to_stack_pointer(a: number): number;
13
- export function __wbindgen_exn_store(a: number): void;
14
- export function __wbindgen_start(): void;
4
+ export const main: (a: number, b: number) => number;
5
+ export const __wbg_buildcss_free: (a: number, b: number) => void;
6
+ export const buildcss_add: (a: number, b: number, c: number, d: number, e: number) => void;
7
+ export const buildcss_compile: (a: number) => [number, number, number];
8
+ export const buildcss_new: (a: number, b: number) => number;
9
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
10
+ export const __wbindgen_malloc: (a: number, b: number) => number;
11
+ export const __wbindgen_exn_store: (a: number) => void;
12
+ export const __externref_table_alloc: () => number;
13
+ export const __wbindgen_externrefs: WebAssembly.Table;
14
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
15
+ export const __externref_table_dealloc: (a: number) => void;
16
+ export const __wbindgen_start: () => void;
@@ -1,60 +1,55 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+
3
4
  /**
4
- * An implementation of `BuildCss` which owns its data, suitable for use as an
5
- * exported type in JavaScript.
6
- */
5
+ * An implementation of `BuildCss` which owns its data, suitable for use as an
6
+ * exported type in JavaScript.
7
+ */
7
8
  export class BuildCss {
8
- free(): void;
9
- /**
10
- * @param {string} rootdir
11
- */
12
- constructor(rootdir: string);
13
- /**
14
- * @param {string} path
15
- * @param {string} content
16
- */
17
- add(path: string, content: string): void;
18
- /**
19
- * @returns {any}
20
- */
21
- compile(): any;
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ add(path: string, content: string): void;
12
+ compile(): any;
13
+ constructor(rootdir: string);
22
14
  }
23
15
 
24
16
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
25
17
 
26
18
  export interface InitOutput {
27
- readonly memory: WebAssembly.Memory;
28
- readonly main: (a: number, b: number) => number;
29
- readonly __wbg_buildcss_free: (a: number) => void;
30
- readonly buildcss_new: (a: number, b: number) => number;
31
- readonly buildcss_add: (a: number, b: number, c: number, d: number, e: number) => void;
32
- readonly buildcss_compile: (a: number, b: number) => void;
33
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
34
- readonly __wbindgen_malloc: (a: number, b: number) => number;
35
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
36
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
37
- readonly __wbindgen_exn_store: (a: number) => void;
38
- readonly __wbindgen_start: () => void;
19
+ readonly memory: WebAssembly.Memory;
20
+ readonly main: (a: number, b: number) => number;
21
+ readonly __wbg_buildcss_free: (a: number, b: number) => void;
22
+ readonly buildcss_add: (a: number, b: number, c: number, d: number, e: number) => void;
23
+ readonly buildcss_compile: (a: number) => [number, number, number];
24
+ readonly buildcss_new: (a: number, b: number) => number;
25
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
26
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
27
+ readonly __wbindgen_exn_store: (a: number) => void;
28
+ readonly __externref_table_alloc: () => number;
29
+ readonly __wbindgen_externrefs: WebAssembly.Table;
30
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
31
+ readonly __externref_table_dealloc: (a: number) => void;
32
+ readonly __wbindgen_start: () => void;
39
33
  }
40
34
 
41
35
  export type SyncInitInput = BufferSource | WebAssembly.Module;
36
+
42
37
  /**
43
- * Instantiates the given `module`, which can either be bytes or
44
- * a precompiled `WebAssembly.Module`.
45
- *
46
- * @param {SyncInitInput} module
47
- *
48
- * @returns {InitOutput}
49
- */
50
- export function initSync(module: SyncInitInput): InitOutput;
38
+ * Instantiates the given `module`, which can either be bytes or
39
+ * a precompiled `WebAssembly.Module`.
40
+ *
41
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
42
+ *
43
+ * @returns {InitOutput}
44
+ */
45
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
51
46
 
52
47
  /**
53
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
54
- * for everything else, calls `WebAssembly.instantiate` directly.
55
- *
56
- * @param {InitInput | Promise<InitInput>} module_or_path
57
- *
58
- * @returns {Promise<InitOutput>}
59
- */
60
- export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
48
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
49
+ * for everything else, calls `WebAssembly.instantiate` directly.
50
+ *
51
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
52
+ *
53
+ * @returns {Promise<InitOutput>}
54
+ */
55
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -1,77 +1,176 @@
1
+ /* @ts-self-types="./procss.d.ts" */
1
2
  import { readFileSync } from 'fs';
2
3
 
3
- let wasm;
4
-
5
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
6
-
7
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
8
-
9
- let cachedUint8Memory0 = null;
10
-
11
- function getUint8Memory0() {
12
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
13
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
4
+ /**
5
+ * An implementation of `BuildCss` which owns its data, suitable for use as an
6
+ * exported type in JavaScript.
7
+ */
8
+ export class BuildCss {
9
+ __destroy_into_raw() {
10
+ const ptr = this.__wbg_ptr;
11
+ this.__wbg_ptr = 0;
12
+ BuildCssFinalization.unregister(this);
13
+ return ptr;
14
+ }
15
+ free() {
16
+ const ptr = this.__destroy_into_raw();
17
+ wasm.__wbg_buildcss_free(ptr, 0);
18
+ }
19
+ /**
20
+ * @param {string} path
21
+ * @param {string} content
22
+ */
23
+ add(path, content) {
24
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
25
+ const len0 = WASM_VECTOR_LEN;
26
+ const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
27
+ const len1 = WASM_VECTOR_LEN;
28
+ wasm.buildcss_add(this.__wbg_ptr, ptr0, len0, ptr1, len1);
29
+ }
30
+ /**
31
+ * @returns {any}
32
+ */
33
+ compile() {
34
+ const ret = wasm.buildcss_compile(this.__wbg_ptr);
35
+ if (ret[2]) {
36
+ throw takeFromExternrefTable0(ret[1]);
37
+ }
38
+ return takeFromExternrefTable0(ret[0]);
39
+ }
40
+ /**
41
+ * @param {string} rootdir
42
+ */
43
+ constructor(rootdir) {
44
+ const ptr0 = passStringToWasm0(rootdir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
45
+ const len0 = WASM_VECTOR_LEN;
46
+ const ret = wasm.buildcss_new(ptr0, len0);
47
+ this.__wbg_ptr = ret >>> 0;
48
+ BuildCssFinalization.register(this, this.__wbg_ptr, this);
49
+ return this;
14
50
  }
15
- return cachedUint8Memory0;
16
51
  }
52
+ if (Symbol.dispose) BuildCss.prototype[Symbol.dispose] = BuildCss.prototype.free;
17
53
 
18
- function getStringFromWasm0(ptr, len) {
19
- ptr = ptr >>> 0;
20
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
54
+ function __wbg_get_imports() {
55
+ const import0 = {
56
+ __proto__: null,
57
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
58
+ const ret = Error(getStringFromWasm0(arg0, arg1));
59
+ return ret;
60
+ },
61
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
62
+ throw new Error(getStringFromWasm0(arg0, arg1));
63
+ },
64
+ __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
65
+ let deferred0_0;
66
+ let deferred0_1;
67
+ try {
68
+ deferred0_0 = arg0;
69
+ deferred0_1 = arg1;
70
+ console.error(getStringFromWasm0(arg0, arg1));
71
+ } finally {
72
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
73
+ }
74
+ },
75
+ __wbg_new_8a6f238a6ece86ea: function() {
76
+ const ret = new Error();
77
+ return ret;
78
+ },
79
+ __wbg_new_dca287b076112a51: function() {
80
+ const ret = new Map();
81
+ return ret;
82
+ },
83
+ __wbg_readFileSync_1f0dbe90bd0ee621: function() { return handleError(function (arg0, arg1, arg2) {
84
+ const ret = readFileSync(getStringFromWasm0(arg1, arg2));
85
+ const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
86
+ const len1 = WASM_VECTOR_LEN;
87
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
88
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
89
+ }, arguments); },
90
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
91
+ const ret = arg0.set(arg1, arg2);
92
+ return ret;
93
+ },
94
+ __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
95
+ const ret = arg1.stack;
96
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
97
+ const len1 = WASM_VECTOR_LEN;
98
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
99
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
100
+ },
101
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
102
+ // Cast intrinsic for `Ref(String) -> Externref`.
103
+ const ret = getStringFromWasm0(arg0, arg1);
104
+ return ret;
105
+ },
106
+ __wbindgen_init_externref_table: function() {
107
+ const table = wasm.__wbindgen_externrefs;
108
+ const offset = table.grow(4);
109
+ table.set(0, undefined);
110
+ table.set(offset + 0, undefined);
111
+ table.set(offset + 1, null);
112
+ table.set(offset + 2, true);
113
+ table.set(offset + 3, false);
114
+ },
115
+ };
116
+ return {
117
+ __proto__: null,
118
+ "./procss_bg.js": import0,
119
+ };
21
120
  }
22
121
 
23
- const heap = new Array(128).fill(undefined);
122
+ const BuildCssFinalization = (typeof FinalizationRegistry === 'undefined')
123
+ ? { register: () => {}, unregister: () => {} }
124
+ : new FinalizationRegistry(ptr => wasm.__wbg_buildcss_free(ptr >>> 0, 1));
24
125
 
25
- heap.push(undefined, null, true, false);
26
-
27
- let heap_next = heap.length;
28
-
29
- function addHeapObject(obj) {
30
- if (heap_next === heap.length) heap.push(heap.length + 1);
31
- const idx = heap_next;
32
- heap_next = heap[idx];
33
-
34
- heap[idx] = obj;
126
+ function addToExternrefTable0(obj) {
127
+ const idx = wasm.__externref_table_alloc();
128
+ wasm.__wbindgen_externrefs.set(idx, obj);
35
129
  return idx;
36
130
  }
37
131
 
38
- function getObject(idx) { return heap[idx]; }
39
-
40
- function dropObject(idx) {
41
- if (idx < 132) return;
42
- heap[idx] = heap_next;
43
- heap_next = idx;
132
+ let cachedDataViewMemory0 = null;
133
+ function getDataViewMemory0() {
134
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
135
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
136
+ }
137
+ return cachedDataViewMemory0;
44
138
  }
45
139
 
46
- function takeObject(idx) {
47
- const ret = getObject(idx);
48
- dropObject(idx);
49
- return ret;
140
+ function getStringFromWasm0(ptr, len) {
141
+ ptr = ptr >>> 0;
142
+ return decodeText(ptr, len);
50
143
  }
51
144
 
52
- let WASM_VECTOR_LEN = 0;
145
+ let cachedUint8ArrayMemory0 = null;
146
+ function getUint8ArrayMemory0() {
147
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
148
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
149
+ }
150
+ return cachedUint8ArrayMemory0;
151
+ }
53
152
 
54
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
153
+ function handleError(f, args) {
154
+ try {
155
+ return f.apply(this, args);
156
+ } catch (e) {
157
+ const idx = addToExternrefTable0(e);
158
+ wasm.__wbindgen_exn_store(idx);
159
+ }
160
+ }
55
161
 
56
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
57
- ? function (arg, view) {
58
- return cachedTextEncoder.encodeInto(arg, view);
162
+ function passArray8ToWasm0(arg, malloc) {
163
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
164
+ getUint8ArrayMemory0().set(arg, ptr / 1);
165
+ WASM_VECTOR_LEN = arg.length;
166
+ return ptr;
59
167
  }
60
- : function (arg, view) {
61
- const buf = cachedTextEncoder.encode(arg);
62
- view.set(buf);
63
- return {
64
- read: arg.length,
65
- written: buf.length
66
- };
67
- });
68
168
 
69
169
  function passStringToWasm0(arg, malloc, realloc) {
70
-
71
170
  if (realloc === undefined) {
72
171
  const buf = cachedTextEncoder.encode(arg);
73
172
  const ptr = malloc(buf.length, 1) >>> 0;
74
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
173
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
75
174
  WASM_VECTOR_LEN = buf.length;
76
175
  return ptr;
77
176
  }
@@ -79,7 +178,7 @@ function passStringToWasm0(arg, malloc, realloc) {
79
178
  let len = arg.length;
80
179
  let ptr = malloc(len, 1) >>> 0;
81
180
 
82
- const mem = getUint8Memory0();
181
+ const mem = getUint8ArrayMemory0();
83
182
 
84
183
  let offset = 0;
85
184
 
@@ -88,101 +187,65 @@ function passStringToWasm0(arg, malloc, realloc) {
88
187
  if (code > 0x7F) break;
89
188
  mem[ptr + offset] = code;
90
189
  }
91
-
92
190
  if (offset !== len) {
93
191
  if (offset !== 0) {
94
192
  arg = arg.slice(offset);
95
193
  }
96
194
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
97
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
98
- const ret = encodeString(arg, view);
195
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
196
+ const ret = cachedTextEncoder.encodeInto(arg, view);
99
197
 
100
198
  offset += ret.written;
199
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
101
200
  }
102
201
 
103
202
  WASM_VECTOR_LEN = offset;
104
203
  return ptr;
105
204
  }
106
205
 
107
- let cachedInt32Memory0 = null;
206
+ function takeFromExternrefTable0(idx) {
207
+ const value = wasm.__wbindgen_externrefs.get(idx);
208
+ wasm.__externref_table_dealloc(idx);
209
+ return value;
210
+ }
108
211
 
109
- function getInt32Memory0() {
110
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
111
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
212
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
213
+ cachedTextDecoder.decode();
214
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
215
+ let numBytesDecoded = 0;
216
+ function decodeText(ptr, len) {
217
+ numBytesDecoded += len;
218
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
219
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
220
+ cachedTextDecoder.decode();
221
+ numBytesDecoded = len;
112
222
  }
113
- return cachedInt32Memory0;
223
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
114
224
  }
115
225
 
116
- function passArray8ToWasm0(arg, malloc) {
117
- const ptr = malloc(arg.length * 1, 1) >>> 0;
118
- getUint8Memory0().set(arg, ptr / 1);
119
- WASM_VECTOR_LEN = arg.length;
120
- return ptr;
121
- }
226
+ const cachedTextEncoder = new TextEncoder();
122
227
 
123
- function handleError(f, args) {
124
- try {
125
- return f.apply(this, args);
126
- } catch (e) {
127
- wasm.__wbindgen_exn_store(addHeapObject(e));
128
- }
228
+ if (!('encodeInto' in cachedTextEncoder)) {
229
+ cachedTextEncoder.encodeInto = function (arg, view) {
230
+ const buf = cachedTextEncoder.encode(arg);
231
+ view.set(buf);
232
+ return {
233
+ read: arg.length,
234
+ written: buf.length
235
+ };
236
+ };
129
237
  }
130
- /**
131
- * An implementation of `BuildCss` which owns its data, suitable for use as an
132
- * exported type in JavaScript.
133
- */
134
- export class BuildCss {
135
-
136
- __destroy_into_raw() {
137
- const ptr = this.__wbg_ptr;
138
- this.__wbg_ptr = 0;
139
238
 
140
- return ptr;
141
- }
239
+ let WASM_VECTOR_LEN = 0;
142
240
 
143
- free() {
144
- const ptr = this.__destroy_into_raw();
145
- wasm.__wbg_buildcss_free(ptr);
146
- }
147
- /**
148
- * @param {string} rootdir
149
- */
150
- constructor(rootdir) {
151
- const ptr0 = passStringToWasm0(rootdir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
152
- const len0 = WASM_VECTOR_LEN;
153
- const ret = wasm.buildcss_new(ptr0, len0);
154
- this.__wbg_ptr = ret >>> 0;
155
- return this;
156
- }
157
- /**
158
- * @param {string} path
159
- * @param {string} content
160
- */
161
- add(path, content) {
162
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
163
- const len0 = WASM_VECTOR_LEN;
164
- const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
165
- const len1 = WASM_VECTOR_LEN;
166
- wasm.buildcss_add(this.__wbg_ptr, ptr0, len0, ptr1, len1);
167
- }
168
- /**
169
- * @returns {any}
170
- */
171
- compile() {
172
- try {
173
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
174
- wasm.buildcss_compile(retptr, this.__wbg_ptr);
175
- var r0 = getInt32Memory0()[retptr / 4 + 0];
176
- var r1 = getInt32Memory0()[retptr / 4 + 1];
177
- var r2 = getInt32Memory0()[retptr / 4 + 2];
178
- if (r2) {
179
- throw takeObject(r1);
180
- }
181
- return takeObject(r0);
182
- } finally {
183
- wasm.__wbindgen_add_to_stack_pointer(16);
184
- }
185
- }
241
+ let wasmModule, wasm;
242
+ function __wbg_finalize_init(instance, module) {
243
+ wasm = instance.exports;
244
+ wasmModule = module;
245
+ cachedDataViewMemory0 = null;
246
+ cachedUint8ArrayMemory0 = null;
247
+ wasm.__wbindgen_start();
248
+ return wasm;
186
249
  }
187
250
 
188
251
  async function __wbg_load(module, imports) {
@@ -190,156 +253,80 @@ async function __wbg_load(module, imports) {
190
253
  if (typeof WebAssembly.instantiateStreaming === 'function') {
191
254
  try {
192
255
  return await WebAssembly.instantiateStreaming(module, imports);
193
-
194
256
  } catch (e) {
195
- if (module.headers.get('Content-Type') != 'application/wasm') {
196
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
257
+ const validResponse = module.ok && expectedResponseType(module.type);
258
+
259
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
260
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
197
261
 
198
- } else {
199
- throw e;
200
- }
262
+ } else { throw e; }
201
263
  }
202
264
  }
203
265
 
204
266
  const bytes = await module.arrayBuffer();
205
267
  return await WebAssembly.instantiate(bytes, imports);
206
-
207
268
  } else {
208
269
  const instance = await WebAssembly.instantiate(module, imports);
209
270
 
210
271
  if (instance instanceof WebAssembly.Instance) {
211
272
  return { instance, module };
212
-
213
273
  } else {
214
274
  return instance;
215
275
  }
216
276
  }
217
- }
218
277
 
219
- function __wbg_get_imports() {
220
- const imports = {};
221
- imports.wbg = {};
222
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
223
- let deferred0_0;
224
- let deferred0_1;
225
- try {
226
- deferred0_0 = arg0;
227
- deferred0_1 = arg1;
228
- console.error(getStringFromWasm0(arg0, arg1));
229
- } finally {
230
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
278
+ function expectedResponseType(type) {
279
+ switch (type) {
280
+ case 'basic': case 'cors': case 'default': return true;
231
281
  }
232
- };
233
- imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
234
- const ret = new Error();
235
- return addHeapObject(ret);
236
- };
237
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
238
- const ret = getObject(arg1).stack;
239
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
- const len1 = WASM_VECTOR_LEN;
241
- getInt32Memory0()[arg0 / 4 + 1] = len1;
242
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
243
- };
244
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
245
- const ret = getStringFromWasm0(arg0, arg1);
246
- return addHeapObject(ret);
247
- };
248
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
249
- takeObject(arg0);
250
- };
251
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
252
- throw new Error(getStringFromWasm0(arg0, arg1));
253
- };
254
- imports.wbg.__wbindgen_is_string = function(arg0) {
255
- const ret = typeof(getObject(arg0)) === 'string';
256
- return ret;
257
- };
258
- imports.wbg.__wbg_new_1b94180eeb48f2a2 = function() {
259
- const ret = new Map();
260
- return addHeapObject(ret);
261
- };
262
- imports.wbg.__wbg_set_3355b9f2d3092e3b = function(arg0, arg1, arg2) {
263
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
264
- return addHeapObject(ret);
265
- };
266
- imports.wbg.__wbg_new_c728d68b8b34487e = function() {
267
- const ret = new Object();
268
- return addHeapObject(ret);
269
- };
270
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
271
- const ret = new Error(getStringFromWasm0(arg0, arg1));
272
- return addHeapObject(ret);
273
- };
274
- imports.wbg.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
275
- const ret = String(getObject(arg1));
276
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
277
- const len1 = WASM_VECTOR_LEN;
278
- getInt32Memory0()[arg0 / 4 + 1] = len1;
279
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
280
- };
281
- imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
282
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
283
- };
284
- imports.wbg.__wbg_readFileSync_74d9a0fda9d26176 = function() { return handleError(function (arg0, arg1, arg2) {
285
- const ret = readFileSync(getStringFromWasm0(arg1, arg2));
286
- const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
287
- const len1 = WASM_VECTOR_LEN;
288
- getInt32Memory0()[arg0 / 4 + 1] = len1;
289
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
290
- }, arguments) };
291
-
292
- return imports;
293
- }
294
-
295
- function __wbg_init_memory(imports, maybe_memory) {
296
-
297
- }
298
-
299
- function __wbg_finalize_init(instance, module) {
300
- wasm = instance.exports;
301
- __wbg_init.__wbindgen_wasm_module = module;
302
- cachedInt32Memory0 = null;
303
- cachedUint8Memory0 = null;
304
-
305
- wasm.__wbindgen_start();
306
- return wasm;
282
+ return false;
283
+ }
307
284
  }
308
285
 
309
286
  function initSync(module) {
310
287
  if (wasm !== undefined) return wasm;
311
288
 
312
- const imports = __wbg_get_imports();
313
289
 
314
- __wbg_init_memory(imports);
290
+ if (module !== undefined) {
291
+ if (Object.getPrototypeOf(module) === Object.prototype) {
292
+ ({module} = module)
293
+ } else {
294
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
295
+ }
296
+ }
315
297
 
298
+ const imports = __wbg_get_imports();
316
299
  if (!(module instanceof WebAssembly.Module)) {
317
300
  module = new WebAssembly.Module(module);
318
301
  }
319
-
320
302
  const instance = new WebAssembly.Instance(module, imports);
321
-
322
303
  return __wbg_finalize_init(instance, module);
323
304
  }
324
305
 
325
- async function __wbg_init(input) {
306
+ async function __wbg_init(module_or_path) {
326
307
  if (wasm !== undefined) return wasm;
327
308
 
328
- if (typeof input === 'undefined') {
329
- input = new URL('procss_bg.wasm', import.meta.url);
309
+
310
+ if (module_or_path !== undefined) {
311
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
312
+ ({module_or_path} = module_or_path)
313
+ } else {
314
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
315
+ }
330
316
  }
331
- const imports = __wbg_get_imports();
332
317
 
333
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
334
- input = fetch(input);
318
+ if (module_or_path === undefined) {
319
+ module_or_path = new URL('procss_bg.wasm', import.meta.url);
335
320
  }
321
+ const imports = __wbg_get_imports();
336
322
 
337
- __wbg_init_memory(imports);
323
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
324
+ module_or_path = fetch(module_or_path);
325
+ }
338
326
 
339
- const { instance, module } = await __wbg_load(await input, imports);
327
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
340
328
 
341
329
  return __wbg_finalize_init(instance, module);
342
330
  }
343
331
 
344
- export { initSync }
345
- export default __wbg_init;
332
+ export { initSync, __wbg_init as default };
Binary file
@@ -1,14 +1,16 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function main(a: number, b: number): number;
5
- export function __wbg_buildcss_free(a: number): void;
6
- export function buildcss_new(a: number, b: number): number;
7
- export function buildcss_add(a: number, b: number, c: number, d: number, e: number): void;
8
- export function buildcss_compile(a: number, b: number): void;
9
- export function __wbindgen_free(a: number, b: number, c: number): void;
10
- export function __wbindgen_malloc(a: number, b: number): number;
11
- export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
12
- export function __wbindgen_add_to_stack_pointer(a: number): number;
13
- export function __wbindgen_exn_store(a: number): void;
14
- export function __wbindgen_start(): void;
4
+ export const main: (a: number, b: number) => number;
5
+ export const __wbg_buildcss_free: (a: number, b: number) => void;
6
+ export const buildcss_add: (a: number, b: number, c: number, d: number, e: number) => void;
7
+ export const buildcss_compile: (a: number) => [number, number, number];
8
+ export const buildcss_new: (a: number, b: number) => number;
9
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
10
+ export const __wbindgen_malloc: (a: number, b: number) => number;
11
+ export const __wbindgen_exn_store: (a: number) => void;
12
+ export const __externref_table_alloc: () => number;
13
+ export const __wbindgen_externrefs: WebAssembly.Table;
14
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
15
+ export const __externref_table_dealloc: (a: number) => void;
16
+ export const __wbindgen_start: () => void;