bq2cst 1.0.0-beta.2 → 1.0.0-beta.3

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