@hpcc-js/wasm 1.13.0 → 1.14.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/README.md CHANGED
@@ -35,13 +35,34 @@ npm install --global @hpcc-js/wasm
35
35
  Usage: dot-wasm [options] fileOrDot
36
36
 
37
37
  Options:
38
- --version Show version number [boolean]
39
- -K, --layout Set layout engine (circo | dot | fdp | sfdp | neato | osage |
40
- patchwork | twopi). By default, dot is used.
41
- -T, --format Set output language to one of the supported formats (svg, dot,
42
- json, dot_json, xdot_json, plain, plain-ext). By default, svg
43
- is produced.
44
- -h, --help Show help [boolean]
38
+ --version Show version number [boolean]
39
+ -K, --layout Set layout engine (circo | dot | fdp | sfdp | neato | osage
40
+ | patchwork | twopi). By default, dot is used.
41
+ -T, --format Set output language to one of the supported formats (svg,
42
+ dot, json, dot_json, xdot_json, plain, plain-ext). By
43
+ default, svg is produced.
44
+ -n, --neato-no-op Sets no-op flag in neato.
45
+ "-n 1" assumes neato nodes have already been positioned and
46
+ all nodes have a pos attribute giving the positions. It
47
+ then performs an optional adjustment to remove node-node
48
+ overlap, depending on the value of the overlap attribute,
49
+ computes the edge layouts, depending on the value of the
50
+ splines attribute, and emits the graph in the appropriate
51
+ format.
52
+ "-n 2" Use node positions as specified, with no adjustment
53
+ to remove node-node overlaps, and use any edge layouts
54
+ already specified by the pos attribute. neato computes an
55
+ edge layout for any edge that does not have a pos
56
+ attribute. As usual, edge layout is guided by the splines
57
+ attribute.
58
+ -y, --invert-y By default, the coordinate system used in generic output
59
+ formats, such as attributed dot, extended dot, plain and
60
+ plain-ext, is the standard cartesian system with the origin
61
+ in the lower left corner, and with increasing y coordinates
62
+ as points move from bottom to top. If the -y flag is used,
63
+ the coordinate system is inverted, so that increasing
64
+ values of y correspond to movement from top to bottom.
65
+ -h, --help Show help [boolean]
45
66
 
46
67
  Examples:
47
68
  dot-wasm -K neato -T xdot ./input.dot Execute NEATO layout and outputs XDOT
package/bin/cli.js CHANGED
@@ -15,6 +15,12 @@ const yargs = require("yargs/yargs")(process.argv.slice(2))
15
15
  .alias("T", "format")
16
16
  .nargs("T", 1)
17
17
  .describe("T", "Set output language to one of the supported formats (svg, dot, json, dot_json, xdot_json, plain, plain-ext). By default, svg is produced.")
18
+ .alias("n", "neato-no-op")
19
+ .nargs("n", 1)
20
+ .describe("n", "Sets no-op flag in neato.\n\"-n 1\" assumes neato nodes have already been positioned and all nodes have a pos attribute giving the positions. It then performs an optional adjustment to remove node-node overlap, depending on the value of the overlap attribute, computes the edge layouts, depending on the value of the splines attribute, and emits the graph in the appropriate format.\n\"-n 2\" Use node positions as specified, with no adjustment to remove node-node overlaps, and use any edge layouts already specified by the pos attribute. neato computes an edge layout for any edge that does not have a pos attribute. As usual, edge layout is guided by the splines attribute.")
21
+ .alias("y", "invert-y")
22
+ .nargs("y", 0)
23
+ .describe("y", "By default, the coordinate system used in generic output formats, such as attributed dot, extended dot, plain and plain-ext, is the standard cartesian system with the origin in the lower left corner, and with increasing y coordinates as points move from bottom to top. If the -y flag is used, the coordinate system is inverted, so that increasing values of y correspond to movement from top to bottom.")
18
24
  .help("h")
19
25
  .alias("h", "help")
20
26
  .epilog("https://github.com/hpcc-systems/hpcc-js-wasm")
@@ -29,7 +35,21 @@ try {
29
35
  } else {
30
36
  dot = argv._[0];
31
37
  }
32
- gvMod.graphviz.layout(dot, argv.format ?? "svg", argv.layout ?? "dot").then(response => {
38
+
39
+ if (argv.n && argv.layout.trim() !== "neato") {
40
+ throw new Error("-n option is only supported with -T neato");
41
+ }
42
+
43
+ const ext = {
44
+ };
45
+ if (argv.n) {
46
+ ext.nop = parseInt(argv.n);
47
+ }
48
+ if (argv.y) {
49
+ ext.yInvert = true;
50
+ }
51
+
52
+ gvMod.graphviz.layout(dot, argv.format?.trim() ?? "svg", argv.layout?.trim() ?? "dot", ext).then(response => {
33
53
  console.log(response);
34
54
  }).catch(e => {
35
55
  console.error(e.message);
package/dist/expat.es6.js CHANGED
@@ -35,10 +35,10 @@ module.exports = cpp;
35
35
 
36
36
  var expatlib = expatlib$2.exports;
37
37
 
38
- var expatlib$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
38
+ var expatlib$1 = /*#__PURE__*/_mergeNamespaces({
39
39
  __proto__: null,
40
40
  'default': expatlib
41
- }, [expatlib$2.exports]));
41
+ }, [expatlib$2.exports]);
42
42
 
43
43
  function getGlobal() {
44
44
  if (typeof self !== "undefined") {
@@ -52,12 +52,12 @@ function getGlobal() {
52
52
  }
53
53
  throw new Error("unable to locate global object");
54
54
  }
55
- var globalNS = getGlobal();
56
- var _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
55
+ const globalNS = getGlobal();
56
+ let _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
57
57
  function wasmFolder(_) {
58
58
  if (!arguments.length)
59
59
  return _wasmFolder;
60
- var retVal = _wasmFolder;
60
+ const retVal = _wasmFolder;
61
61
  _wasmFolder = _;
62
62
  return retVal;
63
63
  }
@@ -74,13 +74,13 @@ function trimStart(str, charToRemove) {
74
74
  return str;
75
75
  }
76
76
  function loadWasm(_wasmLib, wf, wasmBinary) {
77
- var wasmLib = _wasmLib.default || _wasmLib;
77
+ const wasmLib = _wasmLib.default || _wasmLib;
78
78
  // Prevent double load ---
79
79
  if (!wasmLib.__hpcc_promise) {
80
80
  wasmLib.__hpcc_promise = wasmLib({
81
- wasmBinary: wasmBinary,
82
- locateFile: function (path, prefix) {
83
- return "".concat(trimEnd(wf || wasmFolder() || prefix || ".", "/"), "/").concat(trimStart(path, "/"));
81
+ wasmBinary,
82
+ locateFile: (path, prefix) => {
83
+ return `${trimEnd(wf || wasmFolder() || prefix || ".", "/")}/${trimStart(path, "/")}`;
84
84
  }
85
85
  });
86
86
  }
@@ -88,66 +88,60 @@ function loadWasm(_wasmLib, wf, wasmBinary) {
88
88
  }
89
89
 
90
90
  // @ts-ignore
91
- var StackElement = /** @class */ (function () {
92
- function StackElement(tag, attrs) {
91
+ class StackElement {
92
+ constructor(tag, attrs) {
93
93
  this.tag = tag;
94
94
  this.attrs = attrs;
95
95
  this._content = "";
96
96
  }
97
- Object.defineProperty(StackElement.prototype, "content", {
98
- get: function () {
99
- return this._content;
100
- },
101
- enumerable: false,
102
- configurable: true
103
- });
104
- StackElement.prototype.appendContent = function (content) {
97
+ get content() {
98
+ return this._content;
99
+ }
100
+ appendContent(content) {
105
101
  this._content += content;
106
- };
107
- return StackElement;
108
- }());
109
- var StackParser = /** @class */ (function () {
110
- function StackParser() {
102
+ }
103
+ }
104
+ class StackParser {
105
+ constructor() {
111
106
  this._stack = [];
112
107
  }
113
- StackParser.prototype.parse = function (xml, wasmFolder, wasmBinary) {
108
+ parse(xml, wasmFolder, wasmBinary) {
114
109
  return parse(xml, this, wasmFolder, wasmBinary);
115
- };
116
- StackParser.prototype.top = function () {
110
+ }
111
+ top() {
117
112
  return this._stack[this._stack.length - 1];
118
- };
119
- StackParser.prototype.startElement = function (tag, attrs) {
120
- var retVal = new StackElement(tag, attrs);
113
+ }
114
+ startElement(tag, attrs) {
115
+ const retVal = new StackElement(tag, attrs);
121
116
  this._stack.push(retVal);
122
117
  return retVal;
123
- };
124
- StackParser.prototype.endElement = function (tag) {
118
+ }
119
+ endElement(tag) {
125
120
  return this._stack.pop();
126
- };
127
- StackParser.prototype.characterData = function (content) {
121
+ }
122
+ characterData(content) {
128
123
  this.top().appendContent(content);
129
- };
130
- return StackParser;
131
- }());
124
+ }
125
+ }
132
126
  function parseAttrs(attrs) {
133
- var retVal = {};
134
- var keys = attrs;
135
- var sep = "".concat(String.fromCharCode(1));
136
- var sep2 = "".concat(sep).concat(sep);
137
- keys.split(sep2).filter(function (key) { return !!key; }).forEach(function (key) {
138
- var parts = key.split(sep);
127
+ const retVal = {};
128
+ const keys = attrs;
129
+ const sep = `${String.fromCharCode(1)}`;
130
+ const sep2 = `${sep}${sep}`;
131
+ keys.split(sep2).filter((key) => !!key).forEach((key) => {
132
+ const parts = key.split(sep);
139
133
  retVal[parts[0]] = parts[1];
140
134
  });
141
135
  return retVal;
142
136
  }
143
137
  function expatVersion(wasmFolder, wasmBinary) {
144
- return loadWasm(expatlib$1, wasmFolder, wasmBinary).then(function (module) {
138
+ return loadWasm(expatlib$1, wasmFolder, wasmBinary).then(module => {
145
139
  return module.CExpat.prototype.version();
146
140
  });
147
141
  }
148
142
  function parse(xml, callback, wasmFolder, wasmBinary) {
149
- return loadWasm(expatlib$1, wasmFolder, wasmBinary).then(function (module) {
150
- var parser = new module.CExpatJS();
143
+ return loadWasm(expatlib$1, wasmFolder, wasmBinary).then(module => {
144
+ const parser = new module.CExpatJS();
151
145
  parser.startElement = function () {
152
146
  callback.startElement(this.tag(), parseAttrs(this.attrs()));
153
147
  };
@@ -158,7 +152,7 @@ function parse(xml, callback, wasmFolder, wasmBinary) {
158
152
  callback.characterData(this.content());
159
153
  };
160
154
  parser.create();
161
- var retVal = parser.parse(xml);
155
+ const retVal = parser.parse(xml);
162
156
  parser.destroy();
163
157
  module.destroy(parser);
164
158
  return retVal;