alpathfinder 0.2.7 → 0.2.9

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 CHANGED
@@ -2,18 +2,53 @@
2
2
 
3
3
  A Rust/WASM Pathfinder for Adventure.Land.
4
4
 
5
- This project is a work in progress. It currently doesn't work.
5
+ ## Usage
6
6
 
7
- ## Build
7
+ 1. Run `npm i alpathfinder` to install.
8
+ 2. Import the pathfinder
8
9
 
9
- 1. Run `wasm-pack build` to build.
10
- 2. Add the following lines to `package.json`:
10
+ ```js
11
+ import * as ALPathfinder from "alpathfinder";
12
+ ```
13
+
14
+ 3. Prepare the pathfinder with values from `G` and an optional list of maps you wish to ignore.
15
+
16
+ ```js
17
+ const ignoreMaps = [
18
+ "abtesting",
19
+ "bank_b", // NOTE: Don't ignore if you have access
20
+ "bank_u", // NOTE: Don't ignore if you have access
21
+ "cgallery",
22
+ "d2",
23
+ "d_e",
24
+ "duelland",
25
+ "shellsisland",
26
+ "ship0",
27
+ "test",
28
+ "old_bank",
29
+ "old_main",
30
+ "original_main",
31
+ "resort",
32
+ "resort_e",
33
+ ];
34
+ ALPathfinder.prepare(parent.G, ignoreMaps);
35
+ ```
36
+
37
+ 4. Use the pathfinder
11
38
 
12
39
  ```js
13
- "main": "alpathfinder.js",
14
- "type": "module",
40
+ ALPathfinder.canWalkPath(character.map, character.x, character.y, 123, 456)
41
+ const path = ALPathfinder.getPath(character.map, character.x, character.y, "spookytown", 0, 0, character.speed);
42
+ pathfinder.isWalkable("main", 200, 20)
15
43
  ```
16
44
 
17
- ## Use Locally
45
+ ## Development
46
+
47
+ ### Build
48
+
49
+ 1. Run `wasm-pack build` to build.
50
+ 2. Add `typed-adventureland` as a dependency
51
+
52
+ ### Test
18
53
 
19
- 1. In the node project you want to use the pathfinder, run `npm install alpathfinder@file:../path/to/alpathfinder`.
54
+ 1. After building, install the package by referencing the `pkg` directory that was built `npm i ../path/to/alpathfinder/pkg`.
package/alpathfinder.d.ts CHANGED
@@ -1,10 +1,36 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
- export function canWalkPath(map_name: string, x1: number, y1: number, x2: number, y2: number): boolean;
4
+ import type { GData, MapKey } from "typed-adventureland";
5
5
 
6
- export function getPath(map_from_name: string, x_from: number, y_from: number, map_to_name: string, x_to: number, y_to: number, speed?: number | null): any;
6
+ export interface PathNode {
7
+ map: MapKey;
8
+ x: number;
9
+ y: number;
10
+ method: "move" | "town" | "door" | "transport" | "enter" | "unknown";
11
+ spawn?: number;
12
+ }
7
13
 
8
- export function isWalkable(map_name: string, x_i: number, y_i: number): boolean;
14
+ export function canWalkPath(
15
+ map: MapKey,
16
+ x_from: number,
17
+ y_from: number,
18
+ x_to: number,
19
+ y_to: number,
20
+ ): boolean;
21
+
22
+ export function getPath(
23
+ map_from: MapKey,
24
+ x_from: number,
25
+ y_from: number,
26
+ map_to: MapKey,
27
+ x_to: number,
28
+ y_to: number,
29
+ /** How fast your character can walk. Setting this to a very high number can also reduce the number of town warps. */
30
+ speed?: number,
31
+ ): PathNode[] | null;
32
+
33
+ export function isWalkable(map: MapKey, x: number, y: number): boolean;
34
+
35
+ export function prepare(g: GData, exclude_maps?: MapKey[]): void;
9
36
 
10
- export function prepare(g_js: any, exclude_maps?: any | null): void;
package/alpathfinder.js CHANGED
@@ -1,9 +1,5 @@
1
- /* @ts-self-types="./alpathfinder.d.ts" */
2
-
3
1
  import * as wasm from "./alpathfinder_bg.wasm";
2
+ export * from "./alpathfinder_bg.js";
4
3
  import { __wbg_set_wasm } from "./alpathfinder_bg.js";
5
4
  __wbg_set_wasm(wasm);
6
5
  wasm.__wbindgen_start();
7
- export {
8
- canWalkPath, getPath, isWalkable, prepare
9
- } from "./alpathfinder_bg.js";
@@ -1,3 +1,198 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let cachedUint8ArrayMemory0 = null;
8
+
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
+
18
+ cachedTextDecoder.decode();
19
+
20
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
+ let numBytesDecoded = 0;
22
+ function decodeText(ptr, len) {
23
+ numBytesDecoded += len;
24
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
+ cachedTextDecoder.decode();
27
+ numBytesDecoded = len;
28
+ }
29
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
+ }
31
+
32
+ function getStringFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return decodeText(ptr, len);
35
+ }
36
+
37
+ function isLikeNone(x) {
38
+ return x === undefined || x === null;
39
+ }
40
+
41
+ let cachedDataViewMemory0 = null;
42
+
43
+ function getDataViewMemory0() {
44
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
45
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
46
+ }
47
+ return cachedDataViewMemory0;
48
+ }
49
+
50
+ function debugString(val) {
51
+ // primitive types
52
+ const type = typeof val;
53
+ if (type == 'number' || type == 'boolean' || val == null) {
54
+ return `${val}`;
55
+ }
56
+ if (type == 'string') {
57
+ return `"${val}"`;
58
+ }
59
+ if (type == 'symbol') {
60
+ const description = val.description;
61
+ if (description == null) {
62
+ return 'Symbol';
63
+ } else {
64
+ return `Symbol(${description})`;
65
+ }
66
+ }
67
+ if (type == 'function') {
68
+ const name = val.name;
69
+ if (typeof name == 'string' && name.length > 0) {
70
+ return `Function(${name})`;
71
+ } else {
72
+ return 'Function';
73
+ }
74
+ }
75
+ // objects
76
+ if (Array.isArray(val)) {
77
+ const length = val.length;
78
+ let debug = '[';
79
+ if (length > 0) {
80
+ debug += debugString(val[0]);
81
+ }
82
+ for(let i = 1; i < length; i++) {
83
+ debug += ', ' + debugString(val[i]);
84
+ }
85
+ debug += ']';
86
+ return debug;
87
+ }
88
+ // Test for built-in
89
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
90
+ let className;
91
+ if (builtInMatches && builtInMatches.length > 1) {
92
+ className = builtInMatches[1];
93
+ } else {
94
+ // Failed to match the standard '[object ClassName]'
95
+ return toString.call(val);
96
+ }
97
+ if (className == 'Object') {
98
+ // we're a user defined class or Object
99
+ // JSON.stringify avoids problems with cycles, and is generally much
100
+ // easier than looping through ownProperties of `val`.
101
+ try {
102
+ return 'Object(' + JSON.stringify(val) + ')';
103
+ } catch (_) {
104
+ return 'Object';
105
+ }
106
+ }
107
+ // errors
108
+ if (val instanceof Error) {
109
+ return `${val.name}: ${val.message}\n${val.stack}`;
110
+ }
111
+ // TODO we could test for more things here, like `Set`s and `Map`s.
112
+ return className;
113
+ }
114
+
115
+ let WASM_VECTOR_LEN = 0;
116
+
117
+ const cachedTextEncoder = new TextEncoder();
118
+
119
+ if (!('encodeInto' in cachedTextEncoder)) {
120
+ cachedTextEncoder.encodeInto = function (arg, view) {
121
+ const buf = cachedTextEncoder.encode(arg);
122
+ view.set(buf);
123
+ return {
124
+ read: arg.length,
125
+ written: buf.length
126
+ };
127
+ }
128
+ }
129
+
130
+ function passStringToWasm0(arg, malloc, realloc) {
131
+
132
+ if (realloc === undefined) {
133
+ const buf = cachedTextEncoder.encode(arg);
134
+ const ptr = malloc(buf.length, 1) >>> 0;
135
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
136
+ WASM_VECTOR_LEN = buf.length;
137
+ return ptr;
138
+ }
139
+
140
+ let len = arg.length;
141
+ let ptr = malloc(len, 1) >>> 0;
142
+
143
+ const mem = getUint8ArrayMemory0();
144
+
145
+ let offset = 0;
146
+
147
+ for (; offset < len; offset++) {
148
+ const code = arg.charCodeAt(offset);
149
+ if (code > 0x7F) break;
150
+ mem[ptr + offset] = code;
151
+ }
152
+
153
+ if (offset !== len) {
154
+ if (offset !== 0) {
155
+ arg = arg.slice(offset);
156
+ }
157
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
158
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
159
+ const ret = cachedTextEncoder.encodeInto(arg, view);
160
+
161
+ offset += ret.written;
162
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
163
+ }
164
+
165
+ WASM_VECTOR_LEN = offset;
166
+ return ptr;
167
+ }
168
+
169
+ function addToExternrefTable0(obj) {
170
+ const idx = wasm.__externref_table_alloc();
171
+ wasm.__wbindgen_externrefs.set(idx, obj);
172
+ return idx;
173
+ }
174
+
175
+ function handleError(f, args) {
176
+ try {
177
+ return f.apply(this, args);
178
+ } catch (e) {
179
+ const idx = addToExternrefTable0(e);
180
+ wasm.__wbindgen_exn_store(idx);
181
+ }
182
+ }
183
+
184
+ function getArrayU8FromWasm0(ptr, len) {
185
+ ptr = ptr >>> 0;
186
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
187
+ }
188
+ /**
189
+ * @param {any} g_js
190
+ * @param {any | null} [exclude_maps]
191
+ */
192
+ export function prepare(g_js, exclude_maps) {
193
+ wasm.prepare(g_js, isLikeNone(exclude_maps) ? 0 : addToExternrefTable0(exclude_maps));
194
+ }
195
+
1
196
  /**
2
197
  * @param {string} map_name
3
198
  * @param {number} x1
@@ -45,110 +240,124 @@ export function isWalkable(map_name, x_i, y_i) {
45
240
  return ret !== 0;
46
241
  }
47
242
 
48
- /**
49
- * @param {any} g_js
50
- * @param {any | null} [exclude_maps]
51
- */
52
- export function prepare(g_js, exclude_maps) {
53
- wasm.prepare(g_js, isLikeNone(exclude_maps) ? 0 : addToExternrefTable0(exclude_maps));
54
- }
55
- export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
243
+ export function __wbg_Error_e83987f665cf5504(arg0, arg1) {
56
244
  const ret = Error(getStringFromWasm0(arg0, arg1));
57
245
  return ret;
58
- }
59
- export function __wbg_Number_04624de7d0e8332d(arg0) {
246
+ };
247
+
248
+ export function __wbg_Number_bb48ca12f395cd08(arg0) {
60
249
  const ret = Number(arg0);
61
250
  return ret;
62
- }
63
- export function __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2(arg0, arg1) {
251
+ };
252
+
253
+ export function __wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd(arg0, arg1) {
64
254
  const v = arg1;
65
255
  const ret = typeof(v) === 'bigint' ? v : undefined;
66
256
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
67
257
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
68
- }
69
- export function __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25(arg0) {
258
+ };
259
+
260
+ export function __wbg___wbindgen_boolean_get_6d5a1ee65bab5f68(arg0) {
70
261
  const v = arg0;
71
262
  const ret = typeof(v) === 'boolean' ? v : undefined;
72
263
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
73
- }
74
- export function __wbg___wbindgen_debug_string_0bc8482c6e3508ae(arg0, arg1) {
264
+ };
265
+
266
+ export function __wbg___wbindgen_debug_string_df47ffb5e35e6763(arg0, arg1) {
75
267
  const ret = debugString(arg1);
76
268
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
77
269
  const len1 = WASM_VECTOR_LEN;
78
270
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
79
271
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
80
- }
81
- export function __wbg___wbindgen_in_47fa6863be6f2f25(arg0, arg1) {
272
+ };
273
+
274
+ export function __wbg___wbindgen_in_bb933bd9e1b3bc0f(arg0, arg1) {
82
275
  const ret = arg0 in arg1;
83
276
  return ret;
84
- }
85
- export function __wbg___wbindgen_is_bigint_31b12575b56f32fc(arg0) {
277
+ };
278
+
279
+ export function __wbg___wbindgen_is_bigint_cb320707dcd35f0b(arg0) {
86
280
  const ret = typeof(arg0) === 'bigint';
87
281
  return ret;
88
- }
89
- export function __wbg___wbindgen_is_function_0095a73b8b156f76(arg0) {
282
+ };
283
+
284
+ export function __wbg___wbindgen_is_function_ee8a6c5833c90377(arg0) {
90
285
  const ret = typeof(arg0) === 'function';
91
286
  return ret;
92
- }
93
- export function __wbg___wbindgen_is_object_5ae8e5880f2c1fbd(arg0) {
287
+ };
288
+
289
+ export function __wbg___wbindgen_is_object_c818261d21f283a4(arg0) {
94
290
  const val = arg0;
95
291
  const ret = typeof(val) === 'object' && val !== null;
96
292
  return ret;
97
- }
98
- export function __wbg___wbindgen_is_undefined_9e4d92534c42d778(arg0) {
293
+ };
294
+
295
+ export function __wbg___wbindgen_is_undefined_2d472862bd29a478(arg0) {
99
296
  const ret = arg0 === undefined;
100
297
  return ret;
101
- }
102
- export function __wbg___wbindgen_jsval_eq_11888390b0186270(arg0, arg1) {
298
+ };
299
+
300
+ export function __wbg___wbindgen_jsval_eq_6b13ab83478b1c50(arg0, arg1) {
103
301
  const ret = arg0 === arg1;
104
302
  return ret;
105
- }
106
- export function __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811(arg0, arg1) {
303
+ };
304
+
305
+ export function __wbg___wbindgen_jsval_loose_eq_b664b38a2f582147(arg0, arg1) {
107
306
  const ret = arg0 == arg1;
108
307
  return ret;
109
- }
110
- export function __wbg___wbindgen_number_get_8ff4255516ccad3e(arg0, arg1) {
308
+ };
309
+
310
+ export function __wbg___wbindgen_number_get_a20bf9b85341449d(arg0, arg1) {
111
311
  const obj = arg1;
112
312
  const ret = typeof(obj) === 'number' ? obj : undefined;
113
313
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
114
314
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
115
- }
116
- export function __wbg___wbindgen_string_get_72fb696202c56729(arg0, arg1) {
315
+ };
316
+
317
+ export function __wbg___wbindgen_string_get_e4f06c90489ad01b(arg0, arg1) {
117
318
  const obj = arg1;
118
319
  const ret = typeof(obj) === 'string' ? obj : undefined;
119
320
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
120
321
  var len1 = WASM_VECTOR_LEN;
121
322
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
122
323
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
123
- }
124
- export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
324
+ };
325
+
326
+ export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
125
327
  throw new Error(getStringFromWasm0(arg0, arg1));
126
- }
127
- export function __wbg_call_389efe28435a9388() { return handleError(function (arg0, arg1) {
328
+ };
329
+
330
+ export function __wbg_call_e762c39fa8ea36bf() { return handleError(function (arg0, arg1) {
128
331
  const ret = arg0.call(arg1);
129
332
  return ret;
130
- }, arguments); }
131
- export function __wbg_done_57b39ecd9addfe81(arg0) {
333
+ }, arguments) };
334
+
335
+ export function __wbg_done_2042aa2670fb1db1(arg0) {
132
336
  const ret = arg0.done;
133
337
  return ret;
134
- }
135
- export function __wbg_entries_58c7934c745daac7(arg0) {
338
+ };
339
+
340
+ export function __wbg_entries_e171b586f8f6bdbf(arg0) {
136
341
  const ret = Object.entries(arg0);
137
342
  return ret;
138
- }
139
- export function __wbg_get_9b94d73e6221f75c(arg0, arg1) {
343
+ };
344
+
345
+ export function __wbg_get_7bed016f185add81(arg0, arg1) {
140
346
  const ret = arg0[arg1 >>> 0];
141
347
  return ret;
142
- }
143
- export function __wbg_get_b3ed3ad4be2bc8ac() { return handleError(function (arg0, arg1) {
348
+ };
349
+
350
+ export function __wbg_get_efcb449f58ec27c2() { return handleError(function (arg0, arg1) {
144
351
  const ret = Reflect.get(arg0, arg1);
145
352
  return ret;
146
- }, arguments); }
353
+ }, arguments) };
354
+
147
355
  export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {
148
356
  const ret = arg0[arg1];
149
357
  return ret;
150
- }
151
- export function __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04(arg0) {
358
+ };
359
+
360
+ export function __wbg_instanceof_ArrayBuffer_70beb1189ca63b38(arg0) {
152
361
  let result;
153
362
  try {
154
363
  result = arg0 instanceof ArrayBuffer;
@@ -157,8 +366,9 @@ export function __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04(arg0) {
157
366
  }
158
367
  const ret = result;
159
368
  return ret;
160
- }
161
- export function __wbg_instanceof_Map_53af74335dec57f4(arg0) {
369
+ };
370
+
371
+ export function __wbg_instanceof_Map_8579b5e2ab5437c7(arg0) {
162
372
  let result;
163
373
  try {
164
374
  result = arg0 instanceof Map;
@@ -167,8 +377,9 @@ export function __wbg_instanceof_Map_53af74335dec57f4(arg0) {
167
377
  }
168
378
  const ret = result;
169
379
  return ret;
170
- }
171
- export function __wbg_instanceof_Uint8Array_9b9075935c74707c(arg0) {
380
+ };
381
+
382
+ export function __wbg_instanceof_Uint8Array_20c8e73002f7af98(arg0) {
172
383
  let result;
173
384
  try {
174
385
  result = arg0 instanceof Uint8Array;
@@ -177,80 +388,99 @@ export function __wbg_instanceof_Uint8Array_9b9075935c74707c(arg0) {
177
388
  }
178
389
  const ret = result;
179
390
  return ret;
180
- }
181
- export function __wbg_isArray_d314bb98fcf08331(arg0) {
391
+ };
392
+
393
+ export function __wbg_isArray_96e0af9891d0945d(arg0) {
182
394
  const ret = Array.isArray(arg0);
183
395
  return ret;
184
- }
185
- export function __wbg_isSafeInteger_bfbc7332a9768d2a(arg0) {
396
+ };
397
+
398
+ export function __wbg_isSafeInteger_d216eda7911dde36(arg0) {
186
399
  const ret = Number.isSafeInteger(arg0);
187
400
  return ret;
188
- }
189
- export function __wbg_iterator_6ff6560ca1568e55() {
401
+ };
402
+
403
+ export function __wbg_iterator_e5822695327a3c39() {
190
404
  const ret = Symbol.iterator;
191
405
  return ret;
192
- }
193
- export function __wbg_length_32ed9a279acd054c(arg0) {
406
+ };
407
+
408
+ export function __wbg_length_69bca3cb64fc8748(arg0) {
194
409
  const ret = arg0.length;
195
410
  return ret;
196
- }
197
- export function __wbg_length_35a7bace40f36eac(arg0) {
411
+ };
412
+
413
+ export function __wbg_length_cdd215e10d9dd507(arg0) {
198
414
  const ret = arg0.length;
199
415
  return ret;
200
- }
201
- export function __wbg_new_361308b2356cecd0() {
416
+ };
417
+
418
+ export function __wbg_new_1acc0b6eea89d040() {
202
419
  const ret = new Object();
203
420
  return ret;
204
- }
205
- export function __wbg_new_3eb36ae241fe6f44() {
206
- const ret = new Array();
207
- return ret;
208
- }
209
- export function __wbg_new_dd2b680c8bf6ae29(arg0) {
421
+ };
422
+
423
+ export function __wbg_new_5a79be3ab53b8aa5(arg0) {
210
424
  const ret = new Uint8Array(arg0);
211
425
  return ret;
212
- }
213
- export function __wbg_next_3482f54c49e8af19() { return handleError(function (arg0) {
426
+ };
427
+
428
+ export function __wbg_new_e17d9f43105b08be() {
429
+ const ret = new Array();
430
+ return ret;
431
+ };
432
+
433
+ export function __wbg_next_020810e0ae8ebcb0() { return handleError(function (arg0) {
214
434
  const ret = arg0.next();
215
435
  return ret;
216
- }, arguments); }
217
- export function __wbg_next_418f80d8f5303233(arg0) {
436
+ }, arguments) };
437
+
438
+ export function __wbg_next_2c826fe5dfec6b6a(arg0) {
218
439
  const ret = arg0.next;
219
440
  return ret;
220
- }
221
- export function __wbg_prototypesetcall_bdcdcc5842e4d77d(arg0, arg1, arg2) {
441
+ };
442
+
443
+ export function __wbg_prototypesetcall_2a6620b6922694b2(arg0, arg1, arg2) {
222
444
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
223
- }
445
+ };
446
+
224
447
  export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
225
448
  arg0[arg1] = arg2;
226
- }
227
- export function __wbg_set_f43e577aea94465b(arg0, arg1, arg2) {
449
+ };
450
+
451
+ export function __wbg_set_c213c871859d6500(arg0, arg1, arg2) {
228
452
  arg0[arg1 >>> 0] = arg2;
229
- }
230
- export function __wbg_value_0546255b415e96c1(arg0) {
453
+ };
454
+
455
+ export function __wbg_value_692627309814bb8c(arg0) {
231
456
  const ret = arg0.value;
232
457
  return ret;
233
- }
234
- export function __wbindgen_cast_0000000000000001(arg0) {
235
- // Cast intrinsic for `F64 -> Externref`.
236
- const ret = arg0;
237
- return ret;
238
- }
239
- export function __wbindgen_cast_0000000000000002(arg0) {
240
- // Cast intrinsic for `I64 -> Externref`.
241
- const ret = arg0;
242
- return ret;
243
- }
244
- export function __wbindgen_cast_0000000000000003(arg0, arg1) {
458
+ };
459
+
460
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
245
461
  // Cast intrinsic for `Ref(String) -> Externref`.
246
462
  const ret = getStringFromWasm0(arg0, arg1);
247
463
  return ret;
248
- }
249
- export function __wbindgen_cast_0000000000000004(arg0) {
464
+ };
465
+
466
+ export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
250
467
  // Cast intrinsic for `U64 -> Externref`.
251
468
  const ret = BigInt.asUintN(64, arg0);
252
469
  return ret;
253
- }
470
+ };
471
+
472
+ export function __wbindgen_cast_9ae0607507abb057(arg0) {
473
+ // Cast intrinsic for `I64 -> Externref`.
474
+ const ret = arg0;
475
+ return ret;
476
+ };
477
+
478
+ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
479
+ // Cast intrinsic for `F64 -> Externref`.
480
+ const ret = arg0;
481
+ return ret;
482
+ };
483
+
254
484
  export function __wbindgen_init_externref_table() {
255
485
  const table = wasm.__wbindgen_externrefs;
256
486
  const offset = table.grow(4);
@@ -259,189 +489,11 @@ export function __wbindgen_init_externref_table() {
259
489
  table.set(offset + 1, null);
260
490
  table.set(offset + 2, true);
261
491
  table.set(offset + 3, false);
262
- }
492
+ ;
493
+ };
494
+
263
495
  export function __wbindgen_object_is_undefined(arg0) {
264
496
  const ret = arg0 === undefined;
265
497
  return ret;
266
- }
267
- function addToExternrefTable0(obj) {
268
- const idx = wasm.__externref_table_alloc();
269
- wasm.__wbindgen_externrefs.set(idx, obj);
270
- return idx;
271
- }
272
-
273
- function debugString(val) {
274
- // primitive types
275
- const type = typeof val;
276
- if (type == 'number' || type == 'boolean' || val == null) {
277
- return `${val}`;
278
- }
279
- if (type == 'string') {
280
- return `"${val}"`;
281
- }
282
- if (type == 'symbol') {
283
- const description = val.description;
284
- if (description == null) {
285
- return 'Symbol';
286
- } else {
287
- return `Symbol(${description})`;
288
- }
289
- }
290
- if (type == 'function') {
291
- const name = val.name;
292
- if (typeof name == 'string' && name.length > 0) {
293
- return `Function(${name})`;
294
- } else {
295
- return 'Function';
296
- }
297
- }
298
- // objects
299
- if (Array.isArray(val)) {
300
- const length = val.length;
301
- let debug = '[';
302
- if (length > 0) {
303
- debug += debugString(val[0]);
304
- }
305
- for(let i = 1; i < length; i++) {
306
- debug += ', ' + debugString(val[i]);
307
- }
308
- debug += ']';
309
- return debug;
310
- }
311
- // Test for built-in
312
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
313
- let className;
314
- if (builtInMatches && builtInMatches.length > 1) {
315
- className = builtInMatches[1];
316
- } else {
317
- // Failed to match the standard '[object ClassName]'
318
- return toString.call(val);
319
- }
320
- if (className == 'Object') {
321
- // we're a user defined class or Object
322
- // JSON.stringify avoids problems with cycles, and is generally much
323
- // easier than looping through ownProperties of `val`.
324
- try {
325
- return 'Object(' + JSON.stringify(val) + ')';
326
- } catch (_) {
327
- return 'Object';
328
- }
329
- }
330
- // errors
331
- if (val instanceof Error) {
332
- return `${val.name}: ${val.message}\n${val.stack}`;
333
- }
334
- // TODO we could test for more things here, like `Set`s and `Map`s.
335
- return className;
336
- }
337
-
338
- function getArrayU8FromWasm0(ptr, len) {
339
- ptr = ptr >>> 0;
340
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
341
- }
342
-
343
- let cachedDataViewMemory0 = null;
344
- function getDataViewMemory0() {
345
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
346
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
347
- }
348
- return cachedDataViewMemory0;
349
- }
350
-
351
- function getStringFromWasm0(ptr, len) {
352
- ptr = ptr >>> 0;
353
- return decodeText(ptr, len);
354
- }
355
-
356
- let cachedUint8ArrayMemory0 = null;
357
- function getUint8ArrayMemory0() {
358
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
359
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
360
- }
361
- return cachedUint8ArrayMemory0;
362
- }
363
-
364
- function handleError(f, args) {
365
- try {
366
- return f.apply(this, args);
367
- } catch (e) {
368
- const idx = addToExternrefTable0(e);
369
- wasm.__wbindgen_exn_store(idx);
370
- }
371
- }
372
-
373
- function isLikeNone(x) {
374
- return x === undefined || x === null;
375
- }
376
-
377
- function passStringToWasm0(arg, malloc, realloc) {
378
- if (realloc === undefined) {
379
- const buf = cachedTextEncoder.encode(arg);
380
- const ptr = malloc(buf.length, 1) >>> 0;
381
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
382
- WASM_VECTOR_LEN = buf.length;
383
- return ptr;
384
- }
385
-
386
- let len = arg.length;
387
- let ptr = malloc(len, 1) >>> 0;
388
-
389
- const mem = getUint8ArrayMemory0();
390
-
391
- let offset = 0;
392
-
393
- for (; offset < len; offset++) {
394
- const code = arg.charCodeAt(offset);
395
- if (code > 0x7F) break;
396
- mem[ptr + offset] = code;
397
- }
398
- if (offset !== len) {
399
- if (offset !== 0) {
400
- arg = arg.slice(offset);
401
- }
402
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
403
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
404
- const ret = cachedTextEncoder.encodeInto(arg, view);
405
-
406
- offset += ret.written;
407
- ptr = realloc(ptr, len, offset, 1) >>> 0;
408
- }
409
-
410
- WASM_VECTOR_LEN = offset;
411
- return ptr;
412
- }
413
-
414
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
415
- cachedTextDecoder.decode();
416
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
417
- let numBytesDecoded = 0;
418
- function decodeText(ptr, len) {
419
- numBytesDecoded += len;
420
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
421
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
422
- cachedTextDecoder.decode();
423
- numBytesDecoded = len;
424
- }
425
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
426
- }
427
-
428
- const cachedTextEncoder = new TextEncoder();
429
-
430
- if (!('encodeInto' in cachedTextEncoder)) {
431
- cachedTextEncoder.encodeInto = function (arg, view) {
432
- const buf = cachedTextEncoder.encode(arg);
433
- view.set(buf);
434
- return {
435
- read: arg.length,
436
- written: buf.length
437
- };
438
- };
439
- }
498
+ };
440
499
 
441
- let WASM_VECTOR_LEN = 0;
442
-
443
-
444
- let wasm;
445
- export function __wbg_set_wasm(val) {
446
- wasm = val;
447
- }
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Kent Rasmussen <hyprkookeez@gmail.com>"
6
6
  ],
7
- "version": "0.2.7",
7
+ "version": "0.2.9",
8
8
  "files": [
9
9
  "alpathfinder_bg.wasm",
10
10
  "alpathfinder.js",
@@ -16,5 +16,8 @@
16
16
  "sideEffects": [
17
17
  "./alpathfinder.js",
18
18
  "./snippets/*"
19
- ]
19
+ ],
20
+ "dependencies": {
21
+ "typed-adventureland": "^0.0.54"
22
+ }
20
23
  }