@wasm-fmt/dart_fmt 0.0.2 → 0.1.0

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.d.ts CHANGED
@@ -9,16 +9,16 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
9
9
 
10
10
  export type InitOutput = unknown;
11
11
 
12
- export type SyncInitInput = BufferSource | WebAssembly.Module;
13
- /**
14
- * Instantiates the given `module`, which can either be bytes or
15
- * a precompiled `WebAssembly.Module`.
16
- *
17
- * @param {SyncInitInput} module
18
- *
19
- * @returns {InitOutput}
20
- */
21
- export function initSync(module: SyncInitInput): InitOutput;
12
+ // export type SyncInitInput = BufferSource | WebAssembly.Module;
13
+ // /**
14
+ // * Instantiates the given `module`, which can either be bytes or
15
+ // * a precompiled `WebAssembly.Module`.
16
+ // *
17
+ // * @param {SyncInitInput} module
18
+ // *
19
+ // * @returns {InitOutput}
20
+ // */
21
+ // export function initSync(module: SyncInitInput): InitOutput;
22
22
 
23
23
  /**
24
24
  * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
package/dart_fmt.js CHANGED
@@ -5,18 +5,23 @@ let wasm;
5
5
  function get_imports() {}
6
6
  function init_memory() {}
7
7
 
8
- export function initSync(module) {
9
- if (wasm !== undefined) return wasm;
8
+ // export function initSync(module) {
9
+ // if (wasm !== undefined) return wasm;
10
10
 
11
- const imports = get_imports();
11
+ // const imports = get_imports();
12
12
 
13
- init_memory(imports);
13
+ // init_memory(imports);
14
+
15
+ // module = normalize(module);
14
16
 
17
+ // return (wasm = instantiate(module));
18
+ // }
19
+
20
+ function normalize(module) {
15
21
  if (!(module instanceof WebAssembly.Module)) {
16
- module = new WebAssembly.Module(module);
22
+ return new WebAssembly.Module(module);
17
23
  }
18
-
19
- return (wasm = instantiate(module));
24
+ return module;
20
25
  }
21
26
 
22
27
  export default async function (input) {
@@ -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).then(instantiate));
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
@@ -2,7 +2,7 @@
2
2
  "name": "@wasm-fmt/dart_fmt",
3
3
  "description": "Dart Formatter powered by WASM ported from dart_style",
4
4
  "author": "magic-akari <akari.ccino@gmail.com>",
5
- "version": "0.0.2",
5
+ "version": "0.1.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",