@wasm-fmt/dart_fmt 0.0.1 → 0.0.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/dart_fmt.js +11 -4
- package/package.json +1 -1
package/dart_fmt.js
CHANGED
|
@@ -12,13 +12,18 @@ export function initSync(module) {
|
|
|
12
12
|
|
|
13
13
|
init_memory(imports);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
module = new WebAssembly.Module(module);
|
|
17
|
-
}
|
|
15
|
+
module = normalize(module);
|
|
18
16
|
|
|
19
17
|
return (wasm = instantiate(module));
|
|
20
18
|
}
|
|
21
19
|
|
|
20
|
+
function normalize(module) {
|
|
21
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
22
|
+
return new WebAssembly.Module(module);
|
|
23
|
+
}
|
|
24
|
+
return module;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
export default async function (input) {
|
|
23
28
|
if (wasm !== undefined) return wasm;
|
|
24
29
|
|
|
@@ -37,7 +42,9 @@ export default async function (input) {
|
|
|
37
42
|
|
|
38
43
|
init_memory(imports);
|
|
39
44
|
|
|
40
|
-
return (wasm = await load(await input)
|
|
45
|
+
return (wasm = await load(await input)
|
|
46
|
+
.then(normalize)
|
|
47
|
+
.then(instantiate));
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
async function load(module) {
|
package/package.json
CHANGED