wao 0.12.1 → 0.12.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/cjs/waosm-node.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -18,13 +17,25 @@ Object.keys(_waosm_bg).forEach(function (key) {
18
17
  });
19
18
  var _fs = require("fs");
20
19
  var _path = require("path");
20
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
21
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
23
- var dirPath;
24
- if (typeof __filename !== "undefined" && typeof __dirname !== "undefined") dirPath = __dirname;else dirPath = dirname(fileURLToPath(import.meta.url));
25
- var wasm = (0, _fs.readFileSync)((0, _path.resolve)(dirPath, "./waosm-node/waosm_bg.wasm"));
26
- var wasmModule = new WebAssembly.Module(wasm);
27
- var wasmInstance = new WebAssembly.Instance(wasmModule, {
28
- "./waosm_bg.js": wasmBindings
29
- });
30
- (0, _waosm_bg.__wbg_set_wasm)(wasmInstance.exports);
23
+ var run = function run(dirname) {
24
+ var wasm = (0, _fs.readFileSync)((0, _path.resolve)(dirname, "./waosm-node/waosm_bg.wasm"));
25
+ var wasmModule = new WebAssembly.Module(wasm);
26
+ var wasmInstance = new WebAssembly.Instance(wasmModule, {
27
+ "./waosm_bg.js": wasmBindings
28
+ });
29
+ (0, _waosm_bg.__wbg_set_wasm)(wasmInstance.exports);
30
+ };
31
+ var dirname;
32
+ if (typeof __filename !== "undefined" && typeof __dirname !== "undefined") run(__dirname);else {
33
+ Promise.resolve().then(function () {
34
+ return _interopRequireWildcard(require("./dirname.js"));
35
+ }).then(function (_ref) {
36
+ var dirname = _ref["default"];
37
+ return run(dirname);
38
+ })["catch"](function (e) {
39
+ console.log(e);
40
+ });
41
+ }
package/esm/waosm-node.js CHANGED
@@ -4,14 +4,22 @@ import { __wbg_set_wasm } from "./waosm-node/waosm_bg.js"
4
4
  import { readFileSync } from "fs"
5
5
  import { resolve } from "path"
6
6
 
7
- let dirPath
8
- if (typeof __filename !== "undefined" && typeof __dirname !== "undefined")
9
- dirPath = __dirname
10
- else dirPath = dirname(fileURLToPath(import.meta.url))
7
+ const run = dirname => {
8
+ const wasm = readFileSync(resolve(dirname, "./waosm-node/waosm_bg.wasm"))
9
+ const wasmModule = new WebAssembly.Module(wasm)
10
+ const wasmInstance = new WebAssembly.Instance(wasmModule, {
11
+ "./waosm_bg.js": wasmBindings,
12
+ })
13
+ __wbg_set_wasm(wasmInstance.exports)
14
+ }
11
15
 
12
- const wasm = readFileSync(resolve(dirPath, "./waosm-node/waosm_bg.wasm"))
13
- const wasmModule = new WebAssembly.Module(wasm)
14
- const wasmInstance = new WebAssembly.Instance(wasmModule, {
15
- "./waosm_bg.js": wasmBindings,
16
- })
17
- __wbg_set_wasm(wasmInstance.exports)
16
+ let dirname
17
+ if (typeof __filename !== "undefined" && typeof __dirname !== "undefined")
18
+ run(__dirname)
19
+ else {
20
+ import("./dirname.js")
21
+ .then(({ default: dirname }) => run(dirname))
22
+ .catch(e => {
23
+ console.log(e)
24
+ })
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"