@prospective.co/procss 0.1.16 → 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.16",
3
+ "version": "0.1.18",
4
4
  "description": "A simple CSS parsing and transformation framework.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,6 +39,7 @@ impl NeedsWhitespaceStringExt for str {
39
39
  || x == '+'
40
40
  || x == '"'
41
41
  || x == '\''
42
+ || x == '('
42
43
  })
43
44
  .unwrap_or_default()
44
45
  }
@@ -54,6 +55,7 @@ impl NeedsWhitespaceStringExt for str {
54
55
  || x == '_'
55
56
  || x == '%'
56
57
  || x == '+'
58
+ || x == ')'
57
59
  })
58
60
  .unwrap_or_default()
59
61
  }
@@ -111,7 +113,7 @@ where
111
113
  }
112
114
 
113
115
  /// Parses 1 or more whitespace characters, including comments.
114
- pub fn comment1<'a, E>(input: &'a str) -> IResult<&'_ str, (), E>
116
+ pub fn comment1<'a, E>(input: &'a str) -> IResult<&'a str, (), E>
115
117
  where
116
118
  E: ParseError<&'a str>,
117
119
  {
@@ -123,7 +125,7 @@ where
123
125
  }
124
126
 
125
127
  /// Parses 0 or more whitespace characters, including comments and semicolons.
126
- pub fn sep0<'a, E>(input: &'a str) -> IResult<&'_ str, (), E>
128
+ pub fn sep0<'a, E>(input: &'a str) -> IResult<&'a str, (), E>
127
129
  where
128
130
  E: ParseError<&'a str>,
129
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
- const heap = new Array(128).fill(undefined);
8
-
9
- heap.push(undefined, null, true, false);
10
-
11
- function getObject(idx) { return heap[idx]; }
12
-
13
- let heap_next = heap.length;
14
-
15
- function dropObject(idx) {
16
- if (idx < 132) return;
17
- heap[idx] = heap_next;
18
- heap_next = idx;
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;
50
+ }
19
51
  }
20
-
21
- function takeObject(idx) {
22
- const ret = getObject(idx);
23
- dropObject(idx);
24
- return ret;
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
+ };
25
121
  }
26
122
 
27
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
28
-
29
- cachedTextDecoder.decode();
123
+ const BuildCssFinalization = (typeof FinalizationRegistry === 'undefined')
124
+ ? { register: () => {}, unregister: () => {} }
125
+ : new FinalizationRegistry(ptr => wasm.__wbg_buildcss_free(ptr >>> 0, 1));
30
126
 
31
- let cachedUint8Memory0 = null;
127
+ function addToExternrefTable0(obj) {
128
+ const idx = wasm.__externref_table_alloc();
129
+ wasm.__wbindgen_externrefs.set(idx, obj);
130
+ return idx;
131
+ }
32
132
 
33
- function getUint8Memory0() {
34
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
35
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
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);
36
137
  }
37
- return cachedUint8Memory0;
138
+ return cachedDataViewMemory0;
38
139
  }
39
140
 
40
141
  function getStringFromWasm0(ptr, len) {
41
142
  ptr = ptr >>> 0;
42
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
143
+ return decodeText(ptr, len);
43
144
  }
44
145
 
45
- function addHeapObject(obj) {
46
- if (heap_next === heap.length) heap.push(heap.length + 1);
47
- const idx = heap_next;
48
- heap_next = heap[idx];
49
-
50
- heap[idx] = obj;
51
- return idx;
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;
52
152
  }
53
153
 
54
- let WASM_VECTOR_LEN = 0;
55
-
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,172 +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;
116
- }
117
-
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;
207
+ function takeFromExternrefTable0(idx) {
208
+ const value = wasm.__wbindgen_externrefs.get(idx);
209
+ wasm.__externref_table_dealloc(idx);
210
+ return value;
123
211
  }
124
212
 
125
- function handleError(f, args) {
126
- try {
127
- return f.apply(this, args);
128
- } catch (e) {
129
- wasm.__wbindgen_exn_store(addHeapObject(e));
130
- }
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));
131
217
  }
132
- /**
133
- * An implementation of `BuildCss` which owns its data, suitable for use as an
134
- * exported type in JavaScript.
135
- */
136
- class BuildCss {
137
218
 
138
- __destroy_into_raw() {
139
- const ptr = this.__wbg_ptr;
140
- this.__wbg_ptr = 0;
141
-
142
- return ptr;
143
- }
219
+ const cachedTextEncoder = new TextEncoder();
144
220
 
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
231
 
191
- module.exports.__wbg_new_abda76e883ba8a5f = function() {
192
- const ret = new Error();
193
- return addHeapObject(ret);
194
- };
195
-
196
- module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
197
- const ret = getObject(arg1).stack;
198
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
199
- const len1 = WASM_VECTOR_LEN;
200
- getInt32Memory0()[arg0 / 4 + 1] = len1;
201
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
202
- };
203
-
204
- module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
205
- let deferred0_0;
206
- let deferred0_1;
207
- try {
208
- deferred0_0 = arg0;
209
- deferred0_1 = arg1;
210
- console.error(getStringFromWasm0(arg0, arg1));
211
- } finally {
212
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
213
- }
214
- };
215
-
216
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
217
- takeObject(arg0);
218
- };
219
-
220
- module.exports.__wbg_readFileSync_74d9a0fda9d26176 = function() { return handleError(function (arg0, arg1, arg2) {
221
- const ret = readFileSync(getStringFromWasm0(arg1, arg2));
222
- const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
223
- const len1 = WASM_VECTOR_LEN;
224
- getInt32Memory0()[arg0 / 4 + 1] = len1;
225
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
226
- }, arguments) };
227
-
228
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
229
- const ret = new Error(getStringFromWasm0(arg0, arg1));
230
- return addHeapObject(ret);
231
- };
232
-
233
- module.exports.__wbg_new_1b94180eeb48f2a2 = function() {
234
- const ret = new Map();
235
- return addHeapObject(ret);
236
- };
237
-
238
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
239
- const ret = getStringFromWasm0(arg0, arg1);
240
- return addHeapObject(ret);
241
- };
242
-
243
- module.exports.__wbg_set_3355b9f2d3092e3b = function(arg0, arg1, arg2) {
244
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
245
- return addHeapObject(ret);
246
- };
247
-
248
- module.exports.__wbindgen_throw = function(arg0, arg1) {
249
- throw new Error(getStringFromWasm0(arg0, arg1));
250
- };
251
-
252
- const path = require('path').join(__dirname, 'procss_bg.wasm');
253
- const bytes = require('fs').readFileSync(path);
254
-
255
- const wasmModule = new WebAssembly.Module(bytes);
256
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
257
- wasm = wasmInstance.exports;
258
- module.exports.__wasm = wasm;
232
+ let WASM_VECTOR_LEN = 0;
259
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;
260
238
  wasm.__wbindgen_start();
261
-
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 heap = new Array(128).fill(undefined);
6
-
7
- heap.push(undefined, null, true, false);
8
-
9
- function getObject(idx) { return heap[idx]; }
10
-
11
- let heap_next = heap.length;
12
-
13
- function dropObject(idx) {
14
- if (idx < 132) return;
15
- heap[idx] = heap_next;
16
- heap_next = idx;
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;
50
+ }
17
51
  }
52
+ if (Symbol.dispose) BuildCss.prototype[Symbol.dispose] = BuildCss.prototype.free;
18
53
 
19
- function takeObject(idx) {
20
- const ret = getObject(idx);
21
- dropObject(idx);
22
- return ret;
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
+ };
23
120
  }
24
121
 
25
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
26
-
27
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
122
+ const BuildCssFinalization = (typeof FinalizationRegistry === 'undefined')
123
+ ? { register: () => {}, unregister: () => {} }
124
+ : new FinalizationRegistry(ptr => wasm.__wbg_buildcss_free(ptr >>> 0, 1));
28
125
 
29
- let cachedUint8Memory0 = null;
126
+ function addToExternrefTable0(obj) {
127
+ const idx = wasm.__externref_table_alloc();
128
+ wasm.__wbindgen_externrefs.set(idx, obj);
129
+ return idx;
130
+ }
30
131
 
31
- function getUint8Memory0() {
32
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
33
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
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);
34
136
  }
35
- return cachedUint8Memory0;
137
+ return cachedDataViewMemory0;
36
138
  }
37
139
 
38
140
  function getStringFromWasm0(ptr, len) {
39
141
  ptr = ptr >>> 0;
40
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
142
+ return decodeText(ptr, len);
41
143
  }
42
144
 
43
- function addHeapObject(obj) {
44
- if (heap_next === heap.length) heap.push(heap.length + 1);
45
- const idx = heap_next;
46
- heap_next = heap[idx];
47
-
48
- heap[idx] = obj;
49
- return idx;
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;
50
151
  }
51
152
 
52
- let WASM_VECTOR_LEN = 0;
53
-
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
238
 
136
- __destroy_into_raw() {
137
- const ptr = this.__wbg_ptr;
138
- this.__wbg_ptr = 0;
139
-
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,138 +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_new_abda76e883ba8a5f = function() {
223
- const ret = new Error();
224
- return addHeapObject(ret);
225
- };
226
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
227
- const ret = getObject(arg1).stack;
228
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
229
- const len1 = WASM_VECTOR_LEN;
230
- getInt32Memory0()[arg0 / 4 + 1] = len1;
231
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
232
- };
233
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
234
- let deferred0_0;
235
- let deferred0_1;
236
- try {
237
- deferred0_0 = arg0;
238
- deferred0_1 = arg1;
239
- console.error(getStringFromWasm0(arg0, arg1));
240
- } finally {
241
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
278
+ function expectedResponseType(type) {
279
+ switch (type) {
280
+ case 'basic': case 'cors': case 'default': return true;
242
281
  }
243
- };
244
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
245
- takeObject(arg0);
246
- };
247
- imports.wbg.__wbg_readFileSync_74d9a0fda9d26176 = function() { return handleError(function (arg0, arg1, arg2) {
248
- const ret = readFileSync(getStringFromWasm0(arg1, arg2));
249
- const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
250
- const len1 = WASM_VECTOR_LEN;
251
- getInt32Memory0()[arg0 / 4 + 1] = len1;
252
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
253
- }, arguments) };
254
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
255
- const ret = new Error(getStringFromWasm0(arg0, arg1));
256
- return addHeapObject(ret);
257
- };
258
- imports.wbg.__wbg_new_1b94180eeb48f2a2 = function() {
259
- const ret = new Map();
260
- return addHeapObject(ret);
261
- };
262
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
263
- const ret = getStringFromWasm0(arg0, arg1);
264
- return addHeapObject(ret);
265
- };
266
- imports.wbg.__wbg_set_3355b9f2d3092e3b = function(arg0, arg1, arg2) {
267
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
268
- return addHeapObject(ret);
269
- };
270
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
271
- throw new Error(getStringFromWasm0(arg0, arg1));
272
- };
273
-
274
- return imports;
275
- }
276
-
277
- function __wbg_init_memory(imports, maybe_memory) {
278
-
279
- }
280
-
281
- function __wbg_finalize_init(instance, module) {
282
- wasm = instance.exports;
283
- __wbg_init.__wbindgen_wasm_module = module;
284
- cachedInt32Memory0 = null;
285
- cachedUint8Memory0 = null;
286
-
287
- wasm.__wbindgen_start();
288
- return wasm;
282
+ return false;
283
+ }
289
284
  }
290
285
 
291
286
  function initSync(module) {
292
287
  if (wasm !== undefined) return wasm;
293
288
 
294
- const imports = __wbg_get_imports();
295
289
 
296
- __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
+ }
297
297
 
298
+ const imports = __wbg_get_imports();
298
299
  if (!(module instanceof WebAssembly.Module)) {
299
300
  module = new WebAssembly.Module(module);
300
301
  }
301
-
302
302
  const instance = new WebAssembly.Instance(module, imports);
303
-
304
303
  return __wbg_finalize_init(instance, module);
305
304
  }
306
305
 
307
- async function __wbg_init(input) {
306
+ async function __wbg_init(module_or_path) {
308
307
  if (wasm !== undefined) return wasm;
309
308
 
310
- if (typeof input === 'undefined') {
311
- 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
+ }
312
316
  }
313
- const imports = __wbg_get_imports();
314
317
 
315
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
316
- input = fetch(input);
318
+ if (module_or_path === undefined) {
319
+ module_or_path = new URL('procss_bg.wasm', import.meta.url);
317
320
  }
321
+ const imports = __wbg_get_imports();
318
322
 
319
- __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
+ }
320
326
 
321
- const { instance, module } = await __wbg_load(await input, imports);
327
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
322
328
 
323
329
  return __wbg_finalize_init(instance, module);
324
330
  }
325
331
 
326
- export { initSync }
327
- 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;