ms-toollib 0.1.0 → 1.2.7-node
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/README.md +3 -69
- package/ms_toollib.d.ts +64 -2
- package/ms_toollib.js +430 -2
- package/ms_toollib_bg.wasm +0 -0
- package/package.json +3 -5
- package/ms_toollib_bg.js +0 -127
package/README.md
CHANGED
|
@@ -1,69 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>
|
|
6
|
-
|
|
7
|
-
<p>
|
|
8
|
-
<a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/travis/rustwasm/wasm-pack-template.svg?style=flat-square" alt="Build Status" /></a>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
<h3>
|
|
12
|
-
<a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a>
|
|
13
|
-
<span> | </span>
|
|
14
|
-
<a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
|
|
15
|
-
</h3>
|
|
16
|
-
|
|
17
|
-
<sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
## About
|
|
21
|
-
|
|
22
|
-
[**📚 Read this template tutorial! 📚**][template-docs]
|
|
23
|
-
|
|
24
|
-
This template is designed for compiling Rust libraries into WebAssembly and
|
|
25
|
-
publishing the resulting package to NPM.
|
|
26
|
-
|
|
27
|
-
Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other
|
|
28
|
-
templates and usages of `wasm-pack`.
|
|
29
|
-
|
|
30
|
-
[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html
|
|
31
|
-
[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html
|
|
32
|
-
|
|
33
|
-
## 🚴 Usage
|
|
34
|
-
|
|
35
|
-
### 🐑 Use `cargo generate` to Clone this Template
|
|
36
|
-
|
|
37
|
-
[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate)
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project
|
|
41
|
-
cd my-project
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### 🛠️ Build with `wasm-pack build`
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
wasm-pack build
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 🔬 Test in Headless Browsers with `wasm-pack test`
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
wasm-pack test --headless --firefox
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### 🎁 Publish to NPM with `wasm-pack publish`
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
wasm-pack publish
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## 🔋 Batteries Included
|
|
63
|
-
|
|
64
|
-
* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
|
|
65
|
-
between WebAssembly and JavaScript.
|
|
66
|
-
* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)
|
|
67
|
-
for logging panic messages to the developer console.
|
|
68
|
-
* [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized
|
|
69
|
-
for small code size.
|
|
1
|
+
# 扫雷算法工具箱
|
|
2
|
+
还没写
|
|
3
|
+
文档见https://docs.rs/ms_toollib/latest/ms_toollib/
|
package/ms_toollib.d.ts
CHANGED
|
@@ -7,10 +7,72 @@ export function greet(): void;
|
|
|
7
7
|
* @param {string} board_json
|
|
8
8
|
* @returns {number}
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function cal3BV(board_json: string): number;
|
|
11
11
|
/**
|
|
12
12
|
* @param {string} board_json
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
export function cal_op(board_json: string): number;
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} board_json
|
|
18
|
+
* @param {number} mine_num
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
export function cal_possibility_onboard(board_json: string, mine_num: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* @param {number} row
|
|
24
|
+
* @param {number} column
|
|
25
|
+
* @param {number} mine_num
|
|
26
|
+
* @param {number} x0
|
|
27
|
+
* @param {number} y0
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
export function laymine_number(row: number, column: number, mine_num: number, x0: number, y0: number): string;
|
|
31
|
+
/**
|
|
32
|
+
* @param {number} row
|
|
33
|
+
* @param {number} column
|
|
34
|
+
* @param {number} mine_num
|
|
35
|
+
* @param {number} x0
|
|
36
|
+
* @param {number} y0
|
|
37
|
+
* @returns {string}
|
|
38
|
+
*/
|
|
39
|
+
export function laymine_op_number(row: number, column: number, mine_num: number, x0: number, y0: number): string;
|
|
40
|
+
/**
|
|
41
|
+
* @param {number} row
|
|
42
|
+
* @param {number} column
|
|
43
|
+
* @param {number} mine_num
|
|
44
|
+
* @param {number} x0
|
|
45
|
+
* @param {number} y0
|
|
46
|
+
* @param {number} min_3BV
|
|
47
|
+
* @param {number} max_3BV
|
|
48
|
+
* @param {number} max_times
|
|
49
|
+
* @param {number} method
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
export function laymine(row: number, column: number, mine_num: number, x0: number, y0: number, min_3BV: number, max_3BV: number, max_times: number, method: number): string;
|
|
53
|
+
/**
|
|
54
|
+
* @param {number} row
|
|
55
|
+
* @param {number} column
|
|
56
|
+
* @param {number} mine_num
|
|
57
|
+
* @param {number} x0
|
|
58
|
+
* @param {number} y0
|
|
59
|
+
* @param {number} min_3BV
|
|
60
|
+
* @param {number} max_3BV
|
|
61
|
+
* @param {number} max_times
|
|
62
|
+
* @param {number} method
|
|
63
|
+
* @returns {string}
|
|
64
|
+
*/
|
|
65
|
+
export function laymine_op(row: number, column: number, mine_num: number, x0: number, y0: number, min_3BV: number, max_3BV: number, max_times: number, method: number): string;
|
|
66
|
+
/**
|
|
67
|
+
* @param {number} row
|
|
68
|
+
* @param {number} column
|
|
13
69
|
* @param {number} mine_num
|
|
70
|
+
* @param {number} x0
|
|
71
|
+
* @param {number} y0
|
|
72
|
+
* @param {number} min_3BV
|
|
73
|
+
* @param {number} max_3BV
|
|
74
|
+
* @param {number} max_times
|
|
75
|
+
* @param {number} enu_limit
|
|
14
76
|
* @returns {string}
|
|
15
77
|
*/
|
|
16
|
-
export function
|
|
78
|
+
export function laymine_solvable(row: number, column: number, mine_num: number, x0: number, y0: number, min_3BV: number, max_3BV: number, max_times: number, enu_limit: number): string;
|
package/ms_toollib.js
CHANGED
|
@@ -1,2 +1,430 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
function addHeapObject(obj) {
|
|
27
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
28
|
+
const idx = heap_next;
|
|
29
|
+
heap_next = heap[idx];
|
|
30
|
+
|
|
31
|
+
heap[idx] = obj;
|
|
32
|
+
return idx;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
36
|
+
|
|
37
|
+
cachedTextDecoder.decode();
|
|
38
|
+
|
|
39
|
+
let cachegetUint8Memory0 = null;
|
|
40
|
+
function getUint8Memory0() {
|
|
41
|
+
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
42
|
+
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
43
|
+
}
|
|
44
|
+
return cachegetUint8Memory0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getStringFromWasm0(ptr, len) {
|
|
48
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
*/
|
|
52
|
+
module.exports.greet = function() {
|
|
53
|
+
wasm.greet();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
let WASM_VECTOR_LEN = 0;
|
|
57
|
+
|
|
58
|
+
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
59
|
+
|
|
60
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
61
|
+
? function (arg, view) {
|
|
62
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
63
|
+
}
|
|
64
|
+
: function (arg, view) {
|
|
65
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
66
|
+
view.set(buf);
|
|
67
|
+
return {
|
|
68
|
+
read: arg.length,
|
|
69
|
+
written: buf.length
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
74
|
+
|
|
75
|
+
if (realloc === undefined) {
|
|
76
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
77
|
+
const ptr = malloc(buf.length);
|
|
78
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
79
|
+
WASM_VECTOR_LEN = buf.length;
|
|
80
|
+
return ptr;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let len = arg.length;
|
|
84
|
+
let ptr = malloc(len);
|
|
85
|
+
|
|
86
|
+
const mem = getUint8Memory0();
|
|
87
|
+
|
|
88
|
+
let offset = 0;
|
|
89
|
+
|
|
90
|
+
for (; offset < len; offset++) {
|
|
91
|
+
const code = arg.charCodeAt(offset);
|
|
92
|
+
if (code > 0x7F) break;
|
|
93
|
+
mem[ptr + offset] = code;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (offset !== len) {
|
|
97
|
+
if (offset !== 0) {
|
|
98
|
+
arg = arg.slice(offset);
|
|
99
|
+
}
|
|
100
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
101
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
102
|
+
const ret = encodeString(arg, view);
|
|
103
|
+
|
|
104
|
+
offset += ret.written;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
WASM_VECTOR_LEN = offset;
|
|
108
|
+
return ptr;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @param {string} board_json
|
|
112
|
+
* @returns {number}
|
|
113
|
+
*/
|
|
114
|
+
module.exports.cal3BV = function(board_json) {
|
|
115
|
+
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
116
|
+
var len0 = WASM_VECTOR_LEN;
|
|
117
|
+
var ret = wasm.cal3BV(ptr0, len0);
|
|
118
|
+
return ret;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @param {string} board_json
|
|
123
|
+
* @returns {number}
|
|
124
|
+
*/
|
|
125
|
+
module.exports.cal_op = function(board_json) {
|
|
126
|
+
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
127
|
+
var len0 = WASM_VECTOR_LEN;
|
|
128
|
+
var ret = wasm.cal_op(ptr0, len0);
|
|
129
|
+
return ret;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
let cachegetInt32Memory0 = null;
|
|
133
|
+
function getInt32Memory0() {
|
|
134
|
+
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
135
|
+
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
136
|
+
}
|
|
137
|
+
return cachegetInt32Memory0;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* @param {string} board_json
|
|
141
|
+
* @param {number} mine_num
|
|
142
|
+
* @returns {string}
|
|
143
|
+
*/
|
|
144
|
+
module.exports.cal_possibility_onboard = function(board_json, mine_num) {
|
|
145
|
+
try {
|
|
146
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
147
|
+
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
148
|
+
var len0 = WASM_VECTOR_LEN;
|
|
149
|
+
wasm.cal_possibility_onboard(retptr, ptr0, len0, mine_num);
|
|
150
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
151
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
152
|
+
return getStringFromWasm0(r0, r1);
|
|
153
|
+
} finally {
|
|
154
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
155
|
+
wasm.__wbindgen_free(r0, r1);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @param {number} row
|
|
161
|
+
* @param {number} column
|
|
162
|
+
* @param {number} mine_num
|
|
163
|
+
* @param {number} x0
|
|
164
|
+
* @param {number} y0
|
|
165
|
+
* @returns {string}
|
|
166
|
+
*/
|
|
167
|
+
module.exports.laymine_number = function(row, column, mine_num, x0, y0) {
|
|
168
|
+
try {
|
|
169
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
170
|
+
wasm.laymine_number(retptr, row, column, mine_num, x0, y0);
|
|
171
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
172
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
173
|
+
return getStringFromWasm0(r0, r1);
|
|
174
|
+
} finally {
|
|
175
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
176
|
+
wasm.__wbindgen_free(r0, r1);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @param {number} row
|
|
182
|
+
* @param {number} column
|
|
183
|
+
* @param {number} mine_num
|
|
184
|
+
* @param {number} x0
|
|
185
|
+
* @param {number} y0
|
|
186
|
+
* @returns {string}
|
|
187
|
+
*/
|
|
188
|
+
module.exports.laymine_op_number = function(row, column, mine_num, x0, y0) {
|
|
189
|
+
try {
|
|
190
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
191
|
+
wasm.laymine_op_number(retptr, row, column, mine_num, x0, y0);
|
|
192
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
193
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
194
|
+
return getStringFromWasm0(r0, r1);
|
|
195
|
+
} finally {
|
|
196
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
197
|
+
wasm.__wbindgen_free(r0, r1);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @param {number} row
|
|
203
|
+
* @param {number} column
|
|
204
|
+
* @param {number} mine_num
|
|
205
|
+
* @param {number} x0
|
|
206
|
+
* @param {number} y0
|
|
207
|
+
* @param {number} min_3BV
|
|
208
|
+
* @param {number} max_3BV
|
|
209
|
+
* @param {number} max_times
|
|
210
|
+
* @param {number} method
|
|
211
|
+
* @returns {string}
|
|
212
|
+
*/
|
|
213
|
+
module.exports.laymine = function(row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method) {
|
|
214
|
+
try {
|
|
215
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
216
|
+
wasm.laymine(retptr, row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method);
|
|
217
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
218
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
219
|
+
return getStringFromWasm0(r0, r1);
|
|
220
|
+
} finally {
|
|
221
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
222
|
+
wasm.__wbindgen_free(r0, r1);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @param {number} row
|
|
228
|
+
* @param {number} column
|
|
229
|
+
* @param {number} mine_num
|
|
230
|
+
* @param {number} x0
|
|
231
|
+
* @param {number} y0
|
|
232
|
+
* @param {number} min_3BV
|
|
233
|
+
* @param {number} max_3BV
|
|
234
|
+
* @param {number} max_times
|
|
235
|
+
* @param {number} method
|
|
236
|
+
* @returns {string}
|
|
237
|
+
*/
|
|
238
|
+
module.exports.laymine_op = function(row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method) {
|
|
239
|
+
try {
|
|
240
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
241
|
+
wasm.laymine_op(retptr, row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method);
|
|
242
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
243
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
244
|
+
return getStringFromWasm0(r0, r1);
|
|
245
|
+
} finally {
|
|
246
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
247
|
+
wasm.__wbindgen_free(r0, r1);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param {number} row
|
|
253
|
+
* @param {number} column
|
|
254
|
+
* @param {number} mine_num
|
|
255
|
+
* @param {number} x0
|
|
256
|
+
* @param {number} y0
|
|
257
|
+
* @param {number} min_3BV
|
|
258
|
+
* @param {number} max_3BV
|
|
259
|
+
* @param {number} max_times
|
|
260
|
+
* @param {number} enu_limit
|
|
261
|
+
* @returns {string}
|
|
262
|
+
*/
|
|
263
|
+
module.exports.laymine_solvable = function(row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, enu_limit) {
|
|
264
|
+
try {
|
|
265
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
266
|
+
wasm.laymine_solvable(retptr, row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, enu_limit);
|
|
267
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
268
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
269
|
+
return getStringFromWasm0(r0, r1);
|
|
270
|
+
} finally {
|
|
271
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
272
|
+
wasm.__wbindgen_free(r0, r1);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
function handleError(f, args) {
|
|
277
|
+
try {
|
|
278
|
+
return f.apply(this, args);
|
|
279
|
+
} catch (e) {
|
|
280
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
285
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
module.exports.__wbg_alert_824f87388a45faa8 = function(arg0, arg1) {
|
|
289
|
+
alert(getStringFromWasm0(arg0, arg1));
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
module.exports.__wbg_getRandomValues_98117e9a7e993920 = function() { return handleError(function (arg0, arg1) {
|
|
293
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
294
|
+
}, arguments) };
|
|
295
|
+
|
|
296
|
+
module.exports.__wbg_randomFillSync_64cc7d048f228ca8 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
297
|
+
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
|
298
|
+
}, arguments) };
|
|
299
|
+
|
|
300
|
+
module.exports.__wbg_process_2f24d6544ea7b200 = function(arg0) {
|
|
301
|
+
var ret = getObject(arg0).process;
|
|
302
|
+
return addHeapObject(ret);
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
module.exports.__wbindgen_is_object = function(arg0) {
|
|
306
|
+
const val = getObject(arg0);
|
|
307
|
+
var ret = typeof(val) === 'object' && val !== null;
|
|
308
|
+
return ret;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
module.exports.__wbg_versions_6164651e75405d4a = function(arg0) {
|
|
312
|
+
var ret = getObject(arg0).versions;
|
|
313
|
+
return addHeapObject(ret);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
317
|
+
takeObject(arg0);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
module.exports.__wbg_node_4b517d861cbcb3bc = function(arg0) {
|
|
321
|
+
var ret = getObject(arg0).node;
|
|
322
|
+
return addHeapObject(ret);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
326
|
+
var ret = typeof(getObject(arg0)) === 'string';
|
|
327
|
+
return ret;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
module.exports.__wbg_crypto_98fc271021c7d2ad = function(arg0) {
|
|
331
|
+
var ret = getObject(arg0).crypto;
|
|
332
|
+
return addHeapObject(ret);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
module.exports.__wbg_msCrypto_a2cdb043d2bfe57f = function(arg0) {
|
|
336
|
+
var ret = getObject(arg0).msCrypto;
|
|
337
|
+
return addHeapObject(ret);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
module.exports.__wbg_modulerequire_3440a4bcf44437db = function() { return handleError(function (arg0, arg1) {
|
|
341
|
+
var ret = module.require(getStringFromWasm0(arg0, arg1));
|
|
342
|
+
return addHeapObject(ret);
|
|
343
|
+
}, arguments) };
|
|
344
|
+
|
|
345
|
+
module.exports.__wbg_newnoargs_be86524d73f67598 = function(arg0, arg1) {
|
|
346
|
+
var ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
347
|
+
return addHeapObject(ret);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
module.exports.__wbg_call_888d259a5fefc347 = function() { return handleError(function (arg0, arg1) {
|
|
351
|
+
var ret = getObject(arg0).call(getObject(arg1));
|
|
352
|
+
return addHeapObject(ret);
|
|
353
|
+
}, arguments) };
|
|
354
|
+
|
|
355
|
+
module.exports.__wbg_self_c6fbdfc2918d5e58 = function() { return handleError(function () {
|
|
356
|
+
var ret = self.self;
|
|
357
|
+
return addHeapObject(ret);
|
|
358
|
+
}, arguments) };
|
|
359
|
+
|
|
360
|
+
module.exports.__wbg_window_baec038b5ab35c54 = function() { return handleError(function () {
|
|
361
|
+
var ret = window.window;
|
|
362
|
+
return addHeapObject(ret);
|
|
363
|
+
}, arguments) };
|
|
364
|
+
|
|
365
|
+
module.exports.__wbg_globalThis_3f735a5746d41fbd = function() { return handleError(function () {
|
|
366
|
+
var ret = globalThis.globalThis;
|
|
367
|
+
return addHeapObject(ret);
|
|
368
|
+
}, arguments) };
|
|
369
|
+
|
|
370
|
+
module.exports.__wbg_global_1bc0b39582740e95 = function() { return handleError(function () {
|
|
371
|
+
var ret = global.global;
|
|
372
|
+
return addHeapObject(ret);
|
|
373
|
+
}, arguments) };
|
|
374
|
+
|
|
375
|
+
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
376
|
+
var ret = getObject(arg0) === undefined;
|
|
377
|
+
return ret;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
module.exports.__wbg_buffer_397eaa4d72ee94dd = function(arg0) {
|
|
381
|
+
var ret = getObject(arg0).buffer;
|
|
382
|
+
return addHeapObject(ret);
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
module.exports.__wbg_new_a7ce447f15ff496f = function(arg0) {
|
|
386
|
+
var ret = new Uint8Array(getObject(arg0));
|
|
387
|
+
return addHeapObject(ret);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
module.exports.__wbg_set_969ad0a60e51d320 = function(arg0, arg1, arg2) {
|
|
391
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
module.exports.__wbg_length_1eb8fc608a0d4cdb = function(arg0) {
|
|
395
|
+
var ret = getObject(arg0).length;
|
|
396
|
+
return ret;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
module.exports.__wbg_newwithlength_929232475839a482 = function(arg0) {
|
|
400
|
+
var ret = new Uint8Array(arg0 >>> 0);
|
|
401
|
+
return addHeapObject(ret);
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
module.exports.__wbg_subarray_8b658422a224f479 = function(arg0, arg1, arg2) {
|
|
405
|
+
var ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
406
|
+
return addHeapObject(ret);
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
410
|
+
var ret = getObject(arg0);
|
|
411
|
+
return addHeapObject(ret);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
415
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
module.exports.__wbindgen_memory = function() {
|
|
419
|
+
var ret = wasm.memory;
|
|
420
|
+
return addHeapObject(ret);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
const path = require('path').join(__dirname, 'ms_toollib_bg.wasm');
|
|
424
|
+
const bytes = require('fs').readFileSync(path);
|
|
425
|
+
|
|
426
|
+
const wasmModule = new WebAssembly.Module(bytes);
|
|
427
|
+
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
428
|
+
wasm = wasmInstance.exports;
|
|
429
|
+
module.exports.__wasm = wasm;
|
|
430
|
+
|
package/ms_toollib_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
"collaborators": [
|
|
4
4
|
"eee555 <50390200+eee555@users.noreply.github.com>"
|
|
5
5
|
],
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "1.2.7-node",
|
|
7
7
|
"files": [
|
|
8
8
|
"ms_toollib_bg.wasm",
|
|
9
9
|
"ms_toollib.js",
|
|
10
|
-
"ms_toollib_bg.js",
|
|
11
10
|
"ms_toollib.d.ts"
|
|
12
11
|
],
|
|
13
|
-
"
|
|
14
|
-
"types": "ms_toollib.d.ts"
|
|
15
|
-
"sideEffects": false
|
|
12
|
+
"main": "ms_toollib.js",
|
|
13
|
+
"types": "ms_toollib.d.ts"
|
|
16
14
|
}
|
package/ms_toollib_bg.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import * as wasm from './ms_toollib_bg.wasm';
|
|
2
|
-
|
|
3
|
-
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
|
4
|
-
|
|
5
|
-
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
6
|
-
|
|
7
|
-
cachedTextDecoder.decode();
|
|
8
|
-
|
|
9
|
-
let cachegetUint8Memory0 = null;
|
|
10
|
-
function getUint8Memory0() {
|
|
11
|
-
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
12
|
-
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
13
|
-
}
|
|
14
|
-
return cachegetUint8Memory0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getStringFromWasm0(ptr, len) {
|
|
18
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
*/
|
|
22
|
-
export function greet() {
|
|
23
|
-
wasm.greet();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let WASM_VECTOR_LEN = 0;
|
|
27
|
-
|
|
28
|
-
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
29
|
-
|
|
30
|
-
let cachedTextEncoder = new lTextEncoder('utf-8');
|
|
31
|
-
|
|
32
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
33
|
-
? function (arg, view) {
|
|
34
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
35
|
-
}
|
|
36
|
-
: function (arg, view) {
|
|
37
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
38
|
-
view.set(buf);
|
|
39
|
-
return {
|
|
40
|
-
read: arg.length,
|
|
41
|
-
written: buf.length
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
46
|
-
|
|
47
|
-
if (realloc === undefined) {
|
|
48
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
49
|
-
const ptr = malloc(buf.length);
|
|
50
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
51
|
-
WASM_VECTOR_LEN = buf.length;
|
|
52
|
-
return ptr;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let len = arg.length;
|
|
56
|
-
let ptr = malloc(len);
|
|
57
|
-
|
|
58
|
-
const mem = getUint8Memory0();
|
|
59
|
-
|
|
60
|
-
let offset = 0;
|
|
61
|
-
|
|
62
|
-
for (; offset < len; offset++) {
|
|
63
|
-
const code = arg.charCodeAt(offset);
|
|
64
|
-
if (code > 0x7F) break;
|
|
65
|
-
mem[ptr + offset] = code;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (offset !== len) {
|
|
69
|
-
if (offset !== 0) {
|
|
70
|
-
arg = arg.slice(offset);
|
|
71
|
-
}
|
|
72
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
73
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
74
|
-
const ret = encodeString(arg, view);
|
|
75
|
-
|
|
76
|
-
offset += ret.written;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
WASM_VECTOR_LEN = offset;
|
|
80
|
-
return ptr;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @param {string} board_json
|
|
84
|
-
* @returns {number}
|
|
85
|
-
*/
|
|
86
|
-
export function wasm_cal3BV(board_json) {
|
|
87
|
-
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
88
|
-
var len0 = WASM_VECTOR_LEN;
|
|
89
|
-
var ret = wasm.wasm_cal3BV(ptr0, len0);
|
|
90
|
-
return ret;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
let cachegetInt32Memory0 = null;
|
|
94
|
-
function getInt32Memory0() {
|
|
95
|
-
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
96
|
-
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
97
|
-
}
|
|
98
|
-
return cachegetInt32Memory0;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @param {string} board_json
|
|
102
|
-
* @param {number} mine_num
|
|
103
|
-
* @returns {string}
|
|
104
|
-
*/
|
|
105
|
-
export function wasm_cal_possibility_onboard(board_json, mine_num) {
|
|
106
|
-
try {
|
|
107
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
108
|
-
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
109
|
-
var len0 = WASM_VECTOR_LEN;
|
|
110
|
-
wasm.wasm_cal_possibility_onboard(retptr, ptr0, len0, mine_num);
|
|
111
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
112
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
113
|
-
return getStringFromWasm0(r0, r1);
|
|
114
|
-
} finally {
|
|
115
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
116
|
-
wasm.__wbindgen_free(r0, r1);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export function __wbg_alert_25568c47dfd92690(arg0, arg1) {
|
|
121
|
-
alert(getStringFromWasm0(arg0, arg1));
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export function __wbindgen_throw(arg0, arg1) {
|
|
125
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
126
|
-
};
|
|
127
|
-
|