bq2cst 0.4.25

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/bq2cst.js ADDED
@@ -0,0 +1,326 @@
1
+ let imports = {};
2
+ imports['__wbindgen_placeholder__'] = module.exports;
3
+ let wasm;
4
+ const { TextDecoder, TextEncoder } = require(`util`);
5
+
6
+ const heap = new Array(32).fill(undefined);
7
+
8
+ heap.push(undefined, null, true, false);
9
+
10
+ function getObject(idx) { return heap[idx]; }
11
+
12
+ let heap_next = heap.length;
13
+
14
+ function dropObject(idx) {
15
+ if (idx < 36) return;
16
+ heap[idx] = heap_next;
17
+ heap_next = idx;
18
+ }
19
+
20
+ function takeObject(idx) {
21
+ const ret = getObject(idx);
22
+ dropObject(idx);
23
+ return ret;
24
+ }
25
+
26
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
+
28
+ cachedTextDecoder.decode();
29
+
30
+ let cachedUint8Memory0 = new Uint8Array();
31
+
32
+ function getUint8Memory0() {
33
+ if (cachedUint8Memory0.byteLength === 0) {
34
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
35
+ }
36
+ return cachedUint8Memory0;
37
+ }
38
+
39
+ function getStringFromWasm0(ptr, len) {
40
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
41
+ }
42
+
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;
50
+ }
51
+
52
+ function debugString(val) {
53
+ // primitive types
54
+ const type = typeof val;
55
+ if (type == 'number' || type == 'boolean' || val == null) {
56
+ return `${val}`;
57
+ }
58
+ if (type == 'string') {
59
+ return `"${val}"`;
60
+ }
61
+ if (type == 'symbol') {
62
+ const description = val.description;
63
+ if (description == null) {
64
+ return 'Symbol';
65
+ } else {
66
+ return `Symbol(${description})`;
67
+ }
68
+ }
69
+ if (type == 'function') {
70
+ const name = val.name;
71
+ if (typeof name == 'string' && name.length > 0) {
72
+ return `Function(${name})`;
73
+ } else {
74
+ return 'Function';
75
+ }
76
+ }
77
+ // objects
78
+ if (Array.isArray(val)) {
79
+ const length = val.length;
80
+ let debug = '[';
81
+ if (length > 0) {
82
+ debug += debugString(val[0]);
83
+ }
84
+ for(let i = 1; i < length; i++) {
85
+ debug += ', ' + debugString(val[i]);
86
+ }
87
+ debug += ']';
88
+ return debug;
89
+ }
90
+ // Test for built-in
91
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
92
+ let className;
93
+ if (builtInMatches.length > 1) {
94
+ className = builtInMatches[1];
95
+ } else {
96
+ // Failed to match the standard '[object ClassName]'
97
+ return toString.call(val);
98
+ }
99
+ if (className == 'Object') {
100
+ // we're a user defined class or Object
101
+ // JSON.stringify avoids problems with cycles, and is generally much
102
+ // easier than looping through ownProperties of `val`.
103
+ try {
104
+ return 'Object(' + JSON.stringify(val) + ')';
105
+ } catch (_) {
106
+ return 'Object';
107
+ }
108
+ }
109
+ // errors
110
+ if (val instanceof Error) {
111
+ return `${val.name}: ${val.message}\n${val.stack}`;
112
+ }
113
+ // TODO we could test for more things here, like `Set`s and `Map`s.
114
+ return className;
115
+ }
116
+
117
+ let WASM_VECTOR_LEN = 0;
118
+
119
+ let cachedTextEncoder = new TextEncoder('utf-8');
120
+
121
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
122
+ ? function (arg, view) {
123
+ return cachedTextEncoder.encodeInto(arg, view);
124
+ }
125
+ : function (arg, view) {
126
+ const buf = cachedTextEncoder.encode(arg);
127
+ view.set(buf);
128
+ return {
129
+ read: arg.length,
130
+ written: buf.length
131
+ };
132
+ });
133
+
134
+ function passStringToWasm0(arg, malloc, realloc) {
135
+
136
+ if (realloc === undefined) {
137
+ const buf = cachedTextEncoder.encode(arg);
138
+ const ptr = malloc(buf.length);
139
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
140
+ WASM_VECTOR_LEN = buf.length;
141
+ return ptr;
142
+ }
143
+
144
+ let len = arg.length;
145
+ let ptr = malloc(len);
146
+
147
+ const mem = getUint8Memory0();
148
+
149
+ let offset = 0;
150
+
151
+ for (; offset < len; offset++) {
152
+ const code = arg.charCodeAt(offset);
153
+ if (code > 0x7F) break;
154
+ mem[ptr + offset] = code;
155
+ }
156
+
157
+ if (offset !== len) {
158
+ if (offset !== 0) {
159
+ arg = arg.slice(offset);
160
+ }
161
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
162
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
163
+ const ret = encodeString(arg, view);
164
+
165
+ offset += ret.written;
166
+ }
167
+
168
+ WASM_VECTOR_LEN = offset;
169
+ return ptr;
170
+ }
171
+
172
+ let cachedInt32Memory0 = new Int32Array();
173
+
174
+ function getInt32Memory0() {
175
+ if (cachedInt32Memory0.byteLength === 0) {
176
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
177
+ }
178
+ return cachedInt32Memory0;
179
+ }
180
+ /**
181
+ * @param {string} code
182
+ * @returns {any}
183
+ */
184
+ module.exports.parse = function(code) {
185
+ try {
186
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
187
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
188
+ const len0 = WASM_VECTOR_LEN;
189
+ wasm.parse(retptr, ptr0, len0);
190
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
191
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
192
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
193
+ if (r2) {
194
+ throw takeObject(r1);
195
+ }
196
+ return takeObject(r0);
197
+ } finally {
198
+ wasm.__wbindgen_add_to_stack_pointer(16);
199
+ }
200
+ };
201
+
202
+ /**
203
+ * @param {string} code
204
+ * @returns {any}
205
+ */
206
+ module.exports.tokenize = function(code) {
207
+ try {
208
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
209
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
210
+ const len0 = WASM_VECTOR_LEN;
211
+ wasm.tokenize(retptr, ptr0, len0);
212
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
213
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
214
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
215
+ if (r2) {
216
+ throw takeObject(r1);
217
+ }
218
+ return takeObject(r0);
219
+ } finally {
220
+ wasm.__wbindgen_add_to_stack_pointer(16);
221
+ }
222
+ };
223
+
224
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
225
+ takeObject(arg0);
226
+ };
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_abda76e883ba8a5f = function() {
234
+ const ret = new Error();
235
+ return addHeapObject(ret);
236
+ };
237
+
238
+ module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
239
+ const ret = getObject(arg1).stack;
240
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
241
+ const len0 = WASM_VECTOR_LEN;
242
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
243
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
244
+ };
245
+
246
+ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
247
+ try {
248
+ console.error(getStringFromWasm0(arg0, arg1));
249
+ } finally {
250
+ wasm.__wbindgen_free(arg0, arg1);
251
+ }
252
+ };
253
+
254
+ module.exports.__wbindgen_number_new = function(arg0) {
255
+ const ret = arg0;
256
+ return addHeapObject(ret);
257
+ };
258
+
259
+ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
260
+ const ret = BigInt.asUintN(64, arg0);
261
+ return addHeapObject(ret);
262
+ };
263
+
264
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
265
+ const ret = getStringFromWasm0(arg0, arg1);
266
+ return addHeapObject(ret);
267
+ };
268
+
269
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
270
+ const ret = getObject(arg0);
271
+ return addHeapObject(ret);
272
+ };
273
+
274
+ module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
275
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
276
+ };
277
+
278
+ module.exports.__wbg_new_1d9a920c6bfc44a8 = function() {
279
+ const ret = new Array();
280
+ return addHeapObject(ret);
281
+ };
282
+
283
+ module.exports.__wbg_new_268f7b7dd3430798 = function() {
284
+ const ret = new Map();
285
+ return addHeapObject(ret);
286
+ };
287
+
288
+ module.exports.__wbg_new_0b9bfdd97583284e = function() {
289
+ const ret = new Object();
290
+ return addHeapObject(ret);
291
+ };
292
+
293
+ module.exports.__wbindgen_is_string = function(arg0) {
294
+ const ret = typeof(getObject(arg0)) === 'string';
295
+ return ret;
296
+ };
297
+
298
+ module.exports.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
299
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
300
+ };
301
+
302
+ module.exports.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
303
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
304
+ return addHeapObject(ret);
305
+ };
306
+
307
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
308
+ const ret = debugString(getObject(arg1));
309
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
310
+ const len0 = WASM_VECTOR_LEN;
311
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
312
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
313
+ };
314
+
315
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
316
+ throw new Error(getStringFromWasm0(arg0, arg1));
317
+ };
318
+
319
+ const path = require('path').join(__dirname, 'bq2cst_bg.wasm');
320
+ const bytes = require('fs').readFileSync(path);
321
+
322
+ const wasmModule = new WebAssembly.Module(bytes);
323
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
324
+ wasm = wasmInstance.exports;
325
+ module.exports.__wasm = wasm;
326
+
package/bq2cst_bg.wasm ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "bq2cst",
3
+ "collaborators": [
4
+ "kitta65 <skndr666m1@gmail.com>"
5
+ ],
6
+ "version": "0.4.25",
7
+ "license": "MIT",
8
+ "files": [
9
+ "bq2cst_bg.wasm",
10
+ "bq2cst.js",
11
+ "bq2cst.d.ts",
12
+ "LICENSE-THIRD-PARTY"
13
+ ],
14
+ "main": "bq2cst.js",
15
+ "types": "bq2cst.d.ts"
16
+ }