@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.
@@ -35,10 +35,10 @@ module.exports = cpp;
35
35
 
36
36
  var graphvizlib = graphvizlib$2.exports;
37
37
 
38
- var graphvizlib$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
38
+ var graphvizlib$1 = /*#__PURE__*/_mergeNamespaces({
39
39
  __proto__: null,
40
40
  'default': graphvizlib
41
- }, [graphvizlib$2.exports]));
41
+ }, [graphvizlib$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,67 +74,52 @@ 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
  }
87
87
  return wasmLib.__hpcc_promise;
88
88
  }
89
89
 
90
- var __assign = (undefined && undefined.__assign) || function () {
91
- __assign = Object.assign || function(t) {
92
- for (var s, i = 1, n = arguments.length; i < n; i++) {
93
- s = arguments[i];
94
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
95
- t[p] = s[p];
96
- }
97
- return t;
98
- };
99
- return __assign.apply(this, arguments);
100
- };
101
- var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
102
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
103
- if (ar || !(i in from)) {
104
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
105
- ar[i] = from[i];
106
- }
107
- }
108
- return to.concat(ar || Array.prototype.slice.call(from));
109
- };
90
+ // @ts-ignore
110
91
  function imageToFile(image) {
111
92
  return {
112
93
  path: image.path,
113
- data: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg width=\"".concat(image.width, "\" height=\"").concat(image.height, "\"></svg>")
94
+ data: `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
95
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
96
+ <svg width="${image.width}" height="${image.height}"></svg>`
114
97
  };
115
98
  }
116
99
  function imagesToFiles(images) {
117
100
  return images.map(imageToFile);
118
101
  }
119
102
  function createFiles(graphviz, _ext) {
120
- var ext = __assign({ images: [], files: [] }, _ext);
121
- __spreadArray(__spreadArray([], ext.files, true), imagesToFiles(ext.images), true).forEach(function (file) { return graphviz.createFile(file.path, file.data); });
103
+ const ext = {
104
+ images: [],
105
+ files: [],
106
+ ..._ext
107
+ };
108
+ [...ext.files, ...imagesToFiles(ext.images)].forEach(file => graphviz.createFile(file.path, file.data));
122
109
  }
123
110
  function graphvizVersion(wasmFolder, wasmBinary) {
124
- return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(function (module) {
111
+ return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(module => {
125
112
  return module.Graphviz.prototype.version();
126
113
  });
127
114
  }
128
- var graphviz = {
129
- layout: function (dotSource, outputFormat, layoutEngine, ext) {
130
- if (outputFormat === void 0) { outputFormat = "svg"; }
131
- if (layoutEngine === void 0) { layoutEngine = "dot"; }
115
+ const graphviz = {
116
+ layout(dotSource, outputFormat = "svg", layoutEngine = "dot", ext) {
132
117
  if (!dotSource)
133
118
  return Promise.resolve("");
134
- return loadWasm(graphvizlib$1, ext === null || ext === void 0 ? void 0 : ext.wasmFolder, ext === null || ext === void 0 ? void 0 : ext.wasmBinary).then(function (module) {
135
- var graphViz = new module.Graphviz((ext === null || ext === void 0 ? void 0 : ext.yInvert) !== undefined ? ext === null || ext === void 0 ? void 0 : ext.yInvert : false, (ext === null || ext === void 0 ? void 0 : ext.nop) !== undefined ? ext === null || ext === void 0 ? void 0 : ext.nop : 0);
119
+ return loadWasm(graphvizlib$1, ext === null || ext === void 0 ? void 0 : ext.wasmFolder, ext === null || ext === void 0 ? void 0 : ext.wasmBinary).then(module => {
120
+ const graphViz = new module.Graphviz((ext === null || ext === void 0 ? void 0 : ext.yInvert) !== undefined ? ext === null || ext === void 0 ? void 0 : ext.yInvert : false, (ext === null || ext === void 0 ? void 0 : ext.nop) !== undefined ? ext === null || ext === void 0 ? void 0 : ext.nop : 0);
136
121
  createFiles(graphViz, ext);
137
- var retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
122
+ const retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
138
123
  module.destroy(graphViz);
139
124
  if (!retVal) {
140
125
  throw new Error(module.Graphviz.prototype.lastError());
@@ -142,93 +127,74 @@ var graphviz = {
142
127
  return retVal;
143
128
  });
144
129
  },
145
- circo: function (dotSource, outputFormat, ext) {
146
- if (outputFormat === void 0) { outputFormat = "svg"; }
130
+ circo(dotSource, outputFormat = "svg", ext) {
147
131
  return this.layout(dotSource, outputFormat, "circo", ext);
148
132
  },
149
- dot: function (dotSource, outputFormat, ext) {
150
- if (outputFormat === void 0) { outputFormat = "svg"; }
133
+ dot(dotSource, outputFormat = "svg", ext) {
151
134
  return this.layout(dotSource, outputFormat, "dot", ext);
152
135
  },
153
- fdp: function (dotSource, outputFormat, ext) {
154
- if (outputFormat === void 0) { outputFormat = "svg"; }
136
+ fdp(dotSource, outputFormat = "svg", ext) {
155
137
  return this.layout(dotSource, outputFormat, "fdp", ext);
156
138
  },
157
- sfdp: function (dotSource, outputFormat, ext) {
158
- if (outputFormat === void 0) { outputFormat = "svg"; }
139
+ sfdp(dotSource, outputFormat = "svg", ext) {
159
140
  return this.layout(dotSource, outputFormat, "sfdp", ext);
160
141
  },
161
- neato: function (dotSource, outputFormat, ext) {
162
- if (outputFormat === void 0) { outputFormat = "svg"; }
142
+ neato(dotSource, outputFormat = "svg", ext) {
163
143
  return this.layout(dotSource, outputFormat, "neato", ext);
164
144
  },
165
- osage: function (dotSource, outputFormat, ext) {
166
- if (outputFormat === void 0) { outputFormat = "svg"; }
145
+ osage(dotSource, outputFormat = "svg", ext) {
167
146
  return this.layout(dotSource, outputFormat, "osage", ext);
168
147
  },
169
- patchwork: function (dotSource, outputFormat, ext) {
170
- if (outputFormat === void 0) { outputFormat = "svg"; }
148
+ patchwork(dotSource, outputFormat = "svg", ext) {
171
149
  return this.layout(dotSource, outputFormat, "patchwork", ext);
172
150
  },
173
- twopi: function (dotSource, outputFormat, ext) {
174
- if (outputFormat === void 0) { outputFormat = "svg"; }
151
+ twopi(dotSource, outputFormat = "svg", ext) {
175
152
  return this.layout(dotSource, outputFormat, "twopi", ext);
176
153
  }
177
154
  };
178
- var GraphvizSync = /** @class */ (function () {
179
- function GraphvizSync(_wasm) {
155
+ class GraphvizSync {
156
+ constructor(_wasm) {
180
157
  this._wasm = _wasm;
181
158
  }
182
- GraphvizSync.prototype.layout = function (dotSource, outputFormat, layoutEngine, ext) {
183
- if (outputFormat === void 0) { outputFormat = "svg"; }
184
- if (layoutEngine === void 0) { layoutEngine = "dot"; }
159
+ layout(dotSource, outputFormat = "svg", layoutEngine = "dot", ext) {
185
160
  if (!dotSource)
186
161
  return "";
187
- var graphViz = new this._wasm.Graphviz((ext === null || ext === void 0 ? void 0 : ext.yInvert) ? 1 : 0, (ext === null || ext === void 0 ? void 0 : ext.nop) ? ext === null || ext === void 0 ? void 0 : ext.nop : 0);
162
+ const graphViz = new this._wasm.Graphviz((ext === null || ext === void 0 ? void 0 : ext.yInvert) ? 1 : 0, (ext === null || ext === void 0 ? void 0 : ext.nop) ? ext === null || ext === void 0 ? void 0 : ext.nop : 0);
188
163
  createFiles(graphViz, ext);
189
- var retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
164
+ const retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
190
165
  this._wasm.destroy(graphViz);
191
166
  if (!retVal) {
192
167
  throw new Error(this._wasm.Graphviz.prototype.lastError());
193
168
  }
194
169
  return retVal;
195
- };
196
- GraphvizSync.prototype.circo = function (dotSource, outputFormat, ext) {
197
- if (outputFormat === void 0) { outputFormat = "svg"; }
170
+ }
171
+ circo(dotSource, outputFormat = "svg", ext) {
198
172
  return this.layout(dotSource, outputFormat, "circo", ext);
199
- };
200
- GraphvizSync.prototype.dot = function (dotSource, outputFormat, ext) {
201
- if (outputFormat === void 0) { outputFormat = "svg"; }
173
+ }
174
+ dot(dotSource, outputFormat = "svg", ext) {
202
175
  return this.layout(dotSource, outputFormat, "dot", ext);
203
- };
204
- GraphvizSync.prototype.fdp = function (dotSource, outputFormat, ext) {
205
- if (outputFormat === void 0) { outputFormat = "svg"; }
176
+ }
177
+ fdp(dotSource, outputFormat = "svg", ext) {
206
178
  return this.layout(dotSource, outputFormat, "fdp", ext);
207
- };
208
- GraphvizSync.prototype.sfdp = function (dotSource, outputFormat, ext) {
209
- if (outputFormat === void 0) { outputFormat = "svg"; }
179
+ }
180
+ sfdp(dotSource, outputFormat = "svg", ext) {
210
181
  return this.layout(dotSource, outputFormat, "sfdp", ext);
211
- };
212
- GraphvizSync.prototype.neato = function (dotSource, outputFormat, ext) {
213
- if (outputFormat === void 0) { outputFormat = "svg"; }
182
+ }
183
+ neato(dotSource, outputFormat = "svg", ext) {
214
184
  return this.layout(dotSource, outputFormat, "neato", ext);
215
- };
216
- GraphvizSync.prototype.osage = function (dotSource, outputFormat, ext) {
217
- if (outputFormat === void 0) { outputFormat = "svg"; }
185
+ }
186
+ osage(dotSource, outputFormat = "svg", ext) {
218
187
  return this.layout(dotSource, outputFormat, "osage", ext);
219
- };
220
- GraphvizSync.prototype.patchwork = function (dotSource, outputFormat, ext) {
221
- if (outputFormat === void 0) { outputFormat = "svg"; }
188
+ }
189
+ patchwork(dotSource, outputFormat = "svg", ext) {
222
190
  return this.layout(dotSource, outputFormat, "patchwork", ext);
223
- };
224
- GraphvizSync.prototype.twopi = function (dotSource, outputFormat, ext) {
225
- if (outputFormat === void 0) { outputFormat = "svg"; }
191
+ }
192
+ twopi(dotSource, outputFormat = "svg", ext) {
226
193
  return this.layout(dotSource, outputFormat, "twopi", ext);
227
- };
228
- return GraphvizSync;
229
- }());
194
+ }
195
+ }
230
196
  function graphvizSync(wasmFolder, wasmBinary) {
231
- return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(function (wasm) { return new GraphvizSync(wasm); });
197
+ return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(wasm => new GraphvizSync(wasm));
232
198
  }
233
199
 
234
200
  export { GraphvizSync, graphviz, graphvizSync, graphvizVersion };