aoe2rec-js 0.1.1 → 0.1.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/aoe2rec_js.d.ts +2 -3
- package/aoe2rec_js.js +86 -72
- package/aoe2rec_js_bg.wasm +0 -0
- package/package.json +1 -1
package/aoe2rec_js.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function greet(): void;
|
|
4
3
|
export function parse_rec(buffer: ArrayBuffer): any;
|
|
5
4
|
|
|
6
5
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
7
6
|
|
|
8
7
|
export interface InitOutput {
|
|
9
8
|
readonly memory: WebAssembly.Memory;
|
|
10
|
-
readonly greet: () => void;
|
|
11
9
|
readonly parse_rec: (a: any) => any;
|
|
10
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
12
11
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
13
12
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
14
|
-
readonly
|
|
13
|
+
readonly __wbindgen_export_3: WebAssembly.Table;
|
|
15
14
|
readonly __wbindgen_start: () => void;
|
|
16
15
|
}
|
|
17
16
|
|
package/aoe2rec_js.js
CHANGED
|
@@ -18,71 +18,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
18
18
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function debugString(val) {
|
|
22
|
-
// primitive types
|
|
23
|
-
const type = typeof val;
|
|
24
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
25
|
-
return `${val}`;
|
|
26
|
-
}
|
|
27
|
-
if (type == 'string') {
|
|
28
|
-
return `"${val}"`;
|
|
29
|
-
}
|
|
30
|
-
if (type == 'symbol') {
|
|
31
|
-
const description = val.description;
|
|
32
|
-
if (description == null) {
|
|
33
|
-
return 'Symbol';
|
|
34
|
-
} else {
|
|
35
|
-
return `Symbol(${description})`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (type == 'function') {
|
|
39
|
-
const name = val.name;
|
|
40
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
41
|
-
return `Function(${name})`;
|
|
42
|
-
} else {
|
|
43
|
-
return 'Function';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// objects
|
|
47
|
-
if (Array.isArray(val)) {
|
|
48
|
-
const length = val.length;
|
|
49
|
-
let debug = '[';
|
|
50
|
-
if (length > 0) {
|
|
51
|
-
debug += debugString(val[0]);
|
|
52
|
-
}
|
|
53
|
-
for(let i = 1; i < length; i++) {
|
|
54
|
-
debug += ', ' + debugString(val[i]);
|
|
55
|
-
}
|
|
56
|
-
debug += ']';
|
|
57
|
-
return debug;
|
|
58
|
-
}
|
|
59
|
-
// Test for built-in
|
|
60
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
61
|
-
let className;
|
|
62
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
63
|
-
className = builtInMatches[1];
|
|
64
|
-
} else {
|
|
65
|
-
// Failed to match the standard '[object ClassName]'
|
|
66
|
-
return toString.call(val);
|
|
67
|
-
}
|
|
68
|
-
if (className == 'Object') {
|
|
69
|
-
// we're a user defined class or Object
|
|
70
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
71
|
-
// easier than looping through ownProperties of `val`.
|
|
72
|
-
try {
|
|
73
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
74
|
-
} catch (_) {
|
|
75
|
-
return 'Object';
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// errors
|
|
79
|
-
if (val instanceof Error) {
|
|
80
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
81
|
-
}
|
|
82
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
83
|
-
return className;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
21
|
let WASM_VECTOR_LEN = 0;
|
|
87
22
|
|
|
88
23
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -148,10 +83,70 @@ function getDataViewMemory0() {
|
|
|
148
83
|
return cachedDataViewMemory0;
|
|
149
84
|
}
|
|
150
85
|
|
|
151
|
-
|
|
152
|
-
|
|
86
|
+
function debugString(val) {
|
|
87
|
+
// primitive types
|
|
88
|
+
const type = typeof val;
|
|
89
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
90
|
+
return `${val}`;
|
|
91
|
+
}
|
|
92
|
+
if (type == 'string') {
|
|
93
|
+
return `"${val}"`;
|
|
94
|
+
}
|
|
95
|
+
if (type == 'symbol') {
|
|
96
|
+
const description = val.description;
|
|
97
|
+
if (description == null) {
|
|
98
|
+
return 'Symbol';
|
|
99
|
+
} else {
|
|
100
|
+
return `Symbol(${description})`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (type == 'function') {
|
|
104
|
+
const name = val.name;
|
|
105
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
106
|
+
return `Function(${name})`;
|
|
107
|
+
} else {
|
|
108
|
+
return 'Function';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// objects
|
|
112
|
+
if (Array.isArray(val)) {
|
|
113
|
+
const length = val.length;
|
|
114
|
+
let debug = '[';
|
|
115
|
+
if (length > 0) {
|
|
116
|
+
debug += debugString(val[0]);
|
|
117
|
+
}
|
|
118
|
+
for(let i = 1; i < length; i++) {
|
|
119
|
+
debug += ', ' + debugString(val[i]);
|
|
120
|
+
}
|
|
121
|
+
debug += ']';
|
|
122
|
+
return debug;
|
|
123
|
+
}
|
|
124
|
+
// Test for built-in
|
|
125
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
126
|
+
let className;
|
|
127
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
128
|
+
className = builtInMatches[1];
|
|
129
|
+
} else {
|
|
130
|
+
// Failed to match the standard '[object ClassName]'
|
|
131
|
+
return toString.call(val);
|
|
132
|
+
}
|
|
133
|
+
if (className == 'Object') {
|
|
134
|
+
// we're a user defined class or Object
|
|
135
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
136
|
+
// easier than looping through ownProperties of `val`.
|
|
137
|
+
try {
|
|
138
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
139
|
+
} catch (_) {
|
|
140
|
+
return 'Object';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// errors
|
|
144
|
+
if (val instanceof Error) {
|
|
145
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
146
|
+
}
|
|
147
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
148
|
+
return className;
|
|
153
149
|
}
|
|
154
|
-
|
|
155
150
|
/**
|
|
156
151
|
* @param {ArrayBuffer} buffer
|
|
157
152
|
* @returns {any}
|
|
@@ -195,13 +190,21 @@ async function __wbg_load(module, imports) {
|
|
|
195
190
|
function __wbg_get_imports() {
|
|
196
191
|
const imports = {};
|
|
197
192
|
imports.wbg = {};
|
|
198
|
-
imports.wbg.__wbg_alert_09ce2bb6b2630a58 = function(arg0, arg1) {
|
|
199
|
-
alert(getStringFromWasm0(arg0, arg1));
|
|
200
|
-
};
|
|
201
193
|
imports.wbg.__wbg_buffer_61b7ce01341d7f88 = function(arg0) {
|
|
202
194
|
const ret = arg0.buffer;
|
|
203
195
|
return ret;
|
|
204
196
|
};
|
|
197
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
198
|
+
let deferred0_0;
|
|
199
|
+
let deferred0_1;
|
|
200
|
+
try {
|
|
201
|
+
deferred0_0 = arg0;
|
|
202
|
+
deferred0_1 = arg1;
|
|
203
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
204
|
+
} finally {
|
|
205
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
205
208
|
imports.wbg.__wbg_length_65d1cd11729ced11 = function(arg0) {
|
|
206
209
|
const ret = arg0.length;
|
|
207
210
|
return ret;
|
|
@@ -218,6 +221,10 @@ function __wbg_get_imports() {
|
|
|
218
221
|
const ret = new Object();
|
|
219
222
|
return ret;
|
|
220
223
|
};
|
|
224
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
225
|
+
const ret = new Error();
|
|
226
|
+
return ret;
|
|
227
|
+
};
|
|
221
228
|
imports.wbg.__wbg_set_1d80752d0d5f0b21 = function(arg0, arg1, arg2) {
|
|
222
229
|
arg0[arg1 >>> 0] = arg2;
|
|
223
230
|
};
|
|
@@ -227,6 +234,13 @@ function __wbg_get_imports() {
|
|
|
227
234
|
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
228
235
|
arg0[arg1] = arg2;
|
|
229
236
|
};
|
|
237
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(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
|
+
};
|
|
230
244
|
imports.wbg.__wbindgen_as_number = function(arg0) {
|
|
231
245
|
const ret = +arg0;
|
|
232
246
|
return ret;
|
|
@@ -239,7 +253,7 @@ function __wbg_get_imports() {
|
|
|
239
253
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
240
254
|
};
|
|
241
255
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
242
|
-
const table = wasm.
|
|
256
|
+
const table = wasm.__wbindgen_export_3;
|
|
243
257
|
const offset = table.grow(4);
|
|
244
258
|
table.set(0, undefined);
|
|
245
259
|
table.set(offset + 0, undefined);
|
package/aoe2rec_js_bg.wasm
CHANGED
|
Binary file
|