@spglib/moyo-wasm 0.7.4 → 0.7.8
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/moyo_wasm.d.ts +30 -28
- package/moyo_wasm.js +137 -153
- package/moyo_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/moyo_wasm.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export interface Lattice {
|
|
4
|
+
basis: [number, number, number, number, number, number, number, number, number];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
7
|
export interface MoyoCell {
|
|
8
8
|
lattice: Lattice;
|
|
9
9
|
positions: [number, number, number][];
|
|
@@ -38,40 +38,42 @@ export interface MoyoOperation {
|
|
|
38
38
|
|
|
39
39
|
export type AngleTolerance = { type: "Radian"; value: number } | { type: "Default" };
|
|
40
40
|
|
|
41
|
-
export interface Lattice {
|
|
42
|
-
basis: [number, number, number, number, number, number, number, number, number];
|
|
43
|
-
}
|
|
44
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Return a strongly-typed DTO; wasm-bindgen + tsify will emit .d.ts based on these Rust types
|
|
44
|
+
*/
|
|
45
|
+
export function analyze_cell(cell_json: string, symprec: number, setting: string): MoyoDataset;
|
|
45
46
|
|
|
46
47
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
47
48
|
|
|
48
49
|
export interface InitOutput {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
readonly memory: WebAssembly.Memory;
|
|
51
|
+
readonly analyze_cell: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
52
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
53
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
54
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
55
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
56
|
+
readonly __wbindgen_start: () => void;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
60
|
+
|
|
59
61
|
/**
|
|
60
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
61
|
-
* a precompiled `WebAssembly.Module`.
|
|
62
|
-
*
|
|
63
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
64
|
-
*
|
|
65
|
-
* @returns {InitOutput}
|
|
66
|
-
*/
|
|
62
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
63
|
+
* a precompiled `WebAssembly.Module`.
|
|
64
|
+
*
|
|
65
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
66
|
+
*
|
|
67
|
+
* @returns {InitOutput}
|
|
68
|
+
*/
|
|
67
69
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
68
70
|
|
|
69
71
|
/**
|
|
70
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
71
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
72
|
-
*
|
|
73
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
74
|
-
*
|
|
75
|
-
* @returns {Promise<InitOutput>}
|
|
76
|
-
*/
|
|
72
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
73
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
74
|
+
*
|
|
75
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
76
|
+
*
|
|
77
|
+
* @returns {Promise<InitOutput>}
|
|
78
|
+
*/
|
|
77
79
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/moyo_wasm.js
CHANGED
|
@@ -1,28 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
/* @ts-self-types="./moyo_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Return a strongly-typed DTO; wasm-bindgen + tsify will emit .d.ts based on these Rust types
|
|
5
|
+
* @param {string} cell_json
|
|
6
|
+
* @param {number} symprec
|
|
7
|
+
* @param {string} setting
|
|
8
|
+
* @returns {MoyoDataset}
|
|
9
|
+
*/
|
|
10
|
+
export function analyze_cell(cell_json, symprec, setting) {
|
|
11
|
+
const ptr0 = passStringToWasm0(cell_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12
|
+
const len0 = WASM_VECTOR_LEN;
|
|
13
|
+
const ptr1 = passStringToWasm0(setting, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
14
|
+
const len1 = WASM_VECTOR_LEN;
|
|
15
|
+
const ret = wasm.analyze_cell(ptr0, len0, symprec, ptr1, len1);
|
|
16
|
+
if (ret[2]) {
|
|
17
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
8
18
|
}
|
|
9
|
-
return
|
|
19
|
+
return takeFromExternrefTable0(ret[0]);
|
|
10
20
|
}
|
|
11
21
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
function __wbg_get_imports() {
|
|
23
|
+
const import0 = {
|
|
24
|
+
__proto__: null,
|
|
25
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
26
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
27
|
+
return ret;
|
|
28
|
+
},
|
|
29
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
30
|
+
const ret = String(arg1);
|
|
31
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
32
|
+
const len1 = WASM_VECTOR_LEN;
|
|
33
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
34
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
35
|
+
},
|
|
36
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
37
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
38
|
+
},
|
|
39
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
40
|
+
const ret = new Object();
|
|
41
|
+
return ret;
|
|
42
|
+
},
|
|
43
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
44
|
+
const ret = new Array();
|
|
45
|
+
return ret;
|
|
46
|
+
},
|
|
47
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
48
|
+
arg0[arg1] = arg2;
|
|
49
|
+
},
|
|
50
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
51
|
+
arg0[arg1 >>> 0] = arg2;
|
|
52
|
+
},
|
|
53
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
54
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
55
|
+
const ret = arg0;
|
|
56
|
+
return ret;
|
|
57
|
+
},
|
|
58
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
59
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
60
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
61
|
+
return ret;
|
|
62
|
+
},
|
|
63
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
64
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
65
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
66
|
+
return ret;
|
|
67
|
+
},
|
|
68
|
+
__wbindgen_init_externref_table: function() {
|
|
69
|
+
const table = wasm.__wbindgen_externrefs;
|
|
70
|
+
const offset = table.grow(4);
|
|
71
|
+
table.set(0, undefined);
|
|
72
|
+
table.set(offset + 0, undefined);
|
|
73
|
+
table.set(offset + 1, null);
|
|
74
|
+
table.set(offset + 2, true);
|
|
75
|
+
table.set(offset + 3, false);
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
__proto__: null,
|
|
80
|
+
"./moyo_wasm_bg.js": import0,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
15
83
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
21
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
-
cachedTextDecoder.decode();
|
|
23
|
-
numBytesDecoded = len;
|
|
84
|
+
let cachedDataViewMemory0 = null;
|
|
85
|
+
function getDataViewMemory0() {
|
|
86
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
87
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
24
88
|
}
|
|
25
|
-
return
|
|
89
|
+
return cachedDataViewMemory0;
|
|
26
90
|
}
|
|
27
91
|
|
|
28
92
|
function getStringFromWasm0(ptr, len) {
|
|
@@ -30,23 +94,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
30
94
|
return decodeText(ptr, len);
|
|
31
95
|
}
|
|
32
96
|
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
38
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
39
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
40
|
-
view.set(buf);
|
|
41
|
-
return {
|
|
42
|
-
read: arg.length,
|
|
43
|
-
written: buf.length
|
|
44
|
-
};
|
|
97
|
+
let cachedUint8ArrayMemory0 = null;
|
|
98
|
+
function getUint8ArrayMemory0() {
|
|
99
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
100
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
45
101
|
}
|
|
102
|
+
return cachedUint8ArrayMemory0;
|
|
46
103
|
}
|
|
47
104
|
|
|
48
105
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
49
|
-
|
|
50
106
|
if (realloc === undefined) {
|
|
51
107
|
const buf = cachedTextEncoder.encode(arg);
|
|
52
108
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -67,7 +123,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
67
123
|
if (code > 0x7F) break;
|
|
68
124
|
mem[ptr + offset] = code;
|
|
69
125
|
}
|
|
70
|
-
|
|
71
126
|
if (offset !== len) {
|
|
72
127
|
if (offset !== 0) {
|
|
73
128
|
arg = arg.slice(offset);
|
|
@@ -84,154 +139,91 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
84
139
|
return ptr;
|
|
85
140
|
}
|
|
86
141
|
|
|
87
|
-
let cachedDataViewMemory0 = null;
|
|
88
|
-
|
|
89
|
-
function getDataViewMemory0() {
|
|
90
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
91
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
92
|
-
}
|
|
93
|
-
return cachedDataViewMemory0;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
142
|
function takeFromExternrefTable0(idx) {
|
|
97
|
-
const value = wasm.
|
|
143
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
98
144
|
wasm.__externref_table_dealloc(idx);
|
|
99
145
|
return value;
|
|
100
146
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const len1 = WASM_VECTOR_LEN;
|
|
113
|
-
const ret = wasm.analyze_cell(ptr0, len0, symprec, ptr1, len1);
|
|
114
|
-
if (ret[2]) {
|
|
115
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
147
|
+
|
|
148
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
149
|
+
cachedTextDecoder.decode();
|
|
150
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
151
|
+
let numBytesDecoded = 0;
|
|
152
|
+
function decodeText(ptr, len) {
|
|
153
|
+
numBytesDecoded += len;
|
|
154
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
155
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
156
|
+
cachedTextDecoder.decode();
|
|
157
|
+
numBytesDecoded = len;
|
|
116
158
|
}
|
|
117
|
-
return
|
|
159
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
118
160
|
}
|
|
119
161
|
|
|
120
|
-
const
|
|
162
|
+
const cachedTextEncoder = new TextEncoder();
|
|
163
|
+
|
|
164
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
165
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
166
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
167
|
+
view.set(buf);
|
|
168
|
+
return {
|
|
169
|
+
read: arg.length,
|
|
170
|
+
written: buf.length
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
let WASM_VECTOR_LEN = 0;
|
|
176
|
+
|
|
177
|
+
let wasmModule, wasm;
|
|
178
|
+
function __wbg_finalize_init(instance, module) {
|
|
179
|
+
wasm = instance.exports;
|
|
180
|
+
wasmModule = module;
|
|
181
|
+
cachedDataViewMemory0 = null;
|
|
182
|
+
cachedUint8ArrayMemory0 = null;
|
|
183
|
+
wasm.__wbindgen_start();
|
|
184
|
+
return wasm;
|
|
185
|
+
}
|
|
121
186
|
|
|
122
187
|
async function __wbg_load(module, imports) {
|
|
123
188
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
124
189
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
125
190
|
try {
|
|
126
191
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
127
|
-
|
|
128
192
|
} catch (e) {
|
|
129
|
-
const validResponse = module.ok &&
|
|
193
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
130
194
|
|
|
131
195
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
132
196
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
133
197
|
|
|
134
|
-
} else {
|
|
135
|
-
throw e;
|
|
136
|
-
}
|
|
198
|
+
} else { throw e; }
|
|
137
199
|
}
|
|
138
200
|
}
|
|
139
201
|
|
|
140
202
|
const bytes = await module.arrayBuffer();
|
|
141
203
|
return await WebAssembly.instantiate(bytes, imports);
|
|
142
|
-
|
|
143
204
|
} else {
|
|
144
205
|
const instance = await WebAssembly.instantiate(module, imports);
|
|
145
206
|
|
|
146
207
|
if (instance instanceof WebAssembly.Instance) {
|
|
147
208
|
return { instance, module };
|
|
148
|
-
|
|
149
209
|
} else {
|
|
150
210
|
return instance;
|
|
151
211
|
}
|
|
152
212
|
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function __wbg_get_imports() {
|
|
156
|
-
const imports = {};
|
|
157
|
-
imports.wbg = {};
|
|
158
|
-
imports.wbg.__wbg_Error_e17e777aac105295 = function(arg0, arg1) {
|
|
159
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
160
|
-
return ret;
|
|
161
|
-
};
|
|
162
|
-
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
163
|
-
const ret = String(arg1);
|
|
164
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
165
|
-
const len1 = WASM_VECTOR_LEN;
|
|
166
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
167
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
168
|
-
};
|
|
169
|
-
imports.wbg.__wbg_new_19c25a3f2fa63a02 = function() {
|
|
170
|
-
const ret = new Object();
|
|
171
|
-
return ret;
|
|
172
|
-
};
|
|
173
|
-
imports.wbg.__wbg_new_1f3a344cf3123716 = function() {
|
|
174
|
-
const ret = new Array();
|
|
175
|
-
return ret;
|
|
176
|
-
};
|
|
177
|
-
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
178
|
-
arg0[arg1] = arg2;
|
|
179
|
-
};
|
|
180
|
-
imports.wbg.__wbg_set_90f6c0f7bd8c0415 = function(arg0, arg1, arg2) {
|
|
181
|
-
arg0[arg1 >>> 0] = arg2;
|
|
182
|
-
};
|
|
183
|
-
imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
|
|
184
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
185
|
-
};
|
|
186
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
187
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
188
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
189
|
-
return ret;
|
|
190
|
-
};
|
|
191
|
-
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
192
|
-
// Cast intrinsic for `U64 -> Externref`.
|
|
193
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
194
|
-
return ret;
|
|
195
|
-
};
|
|
196
|
-
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
197
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
198
|
-
const ret = arg0;
|
|
199
|
-
return ret;
|
|
200
|
-
};
|
|
201
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
202
|
-
const table = wasm.__wbindgen_export_2;
|
|
203
|
-
const offset = table.grow(4);
|
|
204
|
-
table.set(0, undefined);
|
|
205
|
-
table.set(offset + 0, undefined);
|
|
206
|
-
table.set(offset + 1, null);
|
|
207
|
-
table.set(offset + 2, true);
|
|
208
|
-
table.set(offset + 3, false);
|
|
209
|
-
;
|
|
210
|
-
};
|
|
211
213
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function __wbg_finalize_init(instance, module) {
|
|
220
|
-
wasm = instance.exports;
|
|
221
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
222
|
-
cachedDataViewMemory0 = null;
|
|
223
|
-
cachedUint8ArrayMemory0 = null;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
wasm.__wbindgen_start();
|
|
227
|
-
return wasm;
|
|
214
|
+
function expectedResponseType(type) {
|
|
215
|
+
switch (type) {
|
|
216
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
228
220
|
}
|
|
229
221
|
|
|
230
222
|
function initSync(module) {
|
|
231
223
|
if (wasm !== undefined) return wasm;
|
|
232
224
|
|
|
233
225
|
|
|
234
|
-
if (
|
|
226
|
+
if (module !== undefined) {
|
|
235
227
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
236
228
|
({module} = module)
|
|
237
229
|
} else {
|
|
@@ -240,15 +232,10 @@ function initSync(module) {
|
|
|
240
232
|
}
|
|
241
233
|
|
|
242
234
|
const imports = __wbg_get_imports();
|
|
243
|
-
|
|
244
|
-
__wbg_init_memory(imports);
|
|
245
|
-
|
|
246
235
|
if (!(module instanceof WebAssembly.Module)) {
|
|
247
236
|
module = new WebAssembly.Module(module);
|
|
248
237
|
}
|
|
249
|
-
|
|
250
238
|
const instance = new WebAssembly.Instance(module, imports);
|
|
251
|
-
|
|
252
239
|
return __wbg_finalize_init(instance, module);
|
|
253
240
|
}
|
|
254
241
|
|
|
@@ -256,7 +243,7 @@ async function __wbg_init(module_or_path) {
|
|
|
256
243
|
if (wasm !== undefined) return wasm;
|
|
257
244
|
|
|
258
245
|
|
|
259
|
-
if (
|
|
246
|
+
if (module_or_path !== undefined) {
|
|
260
247
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
261
248
|
({module_or_path} = module_or_path)
|
|
262
249
|
} else {
|
|
@@ -264,7 +251,7 @@ async function __wbg_init(module_or_path) {
|
|
|
264
251
|
}
|
|
265
252
|
}
|
|
266
253
|
|
|
267
|
-
if (
|
|
254
|
+
if (module_or_path === undefined) {
|
|
268
255
|
module_or_path = new URL('moyo_wasm_bg.wasm', import.meta.url);
|
|
269
256
|
}
|
|
270
257
|
const imports = __wbg_get_imports();
|
|
@@ -273,12 +260,9 @@ async function __wbg_init(module_or_path) {
|
|
|
273
260
|
module_or_path = fetch(module_or_path);
|
|
274
261
|
}
|
|
275
262
|
|
|
276
|
-
__wbg_init_memory(imports);
|
|
277
|
-
|
|
278
263
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
279
264
|
|
|
280
265
|
return __wbg_finalize_init(instance, module);
|
|
281
266
|
}
|
|
282
267
|
|
|
283
|
-
export { initSync };
|
|
284
|
-
export default __wbg_init;
|
|
268
|
+
export { initSync, __wbg_init as default };
|
package/moyo_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED