@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.
Binary file
package/dist/index.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;
@@ -187,59 +181,44 @@ module.exports = cpp;
187
181
 
188
182
  var graphvizlib = graphvizlib$2.exports;
189
183
 
190
- var graphvizlib$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
184
+ var graphvizlib$1 = /*#__PURE__*/_mergeNamespaces({
191
185
  __proto__: null,
192
186
  'default': graphvizlib
193
- }, [graphvizlib$2.exports]));
187
+ }, [graphvizlib$2.exports]);
194
188
 
195
- var __assign = (undefined && undefined.__assign) || function () {
196
- __assign = Object.assign || function(t) {
197
- for (var s, i = 1, n = arguments.length; i < n; i++) {
198
- s = arguments[i];
199
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
200
- t[p] = s[p];
201
- }
202
- return t;
203
- };
204
- return __assign.apply(this, arguments);
205
- };
206
- var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
207
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
208
- if (ar || !(i in from)) {
209
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
210
- ar[i] = from[i];
211
- }
212
- }
213
- return to.concat(ar || Array.prototype.slice.call(from));
214
- };
189
+ // @ts-ignore
215
190
  function imageToFile(image) {
216
191
  return {
217
192
  path: image.path,
218
- 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>")
193
+ data: `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
194
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
195
+ <svg width="${image.width}" height="${image.height}"></svg>`
219
196
  };
220
197
  }
221
198
  function imagesToFiles(images) {
222
199
  return images.map(imageToFile);
223
200
  }
224
201
  function createFiles(graphviz, _ext) {
225
- var ext = __assign({ images: [], files: [] }, _ext);
226
- __spreadArray(__spreadArray([], ext.files, true), imagesToFiles(ext.images), true).forEach(function (file) { return graphviz.createFile(file.path, file.data); });
202
+ const ext = {
203
+ images: [],
204
+ files: [],
205
+ ..._ext
206
+ };
207
+ [...ext.files, ...imagesToFiles(ext.images)].forEach(file => graphviz.createFile(file.path, file.data));
227
208
  }
228
209
  function graphvizVersion(wasmFolder, wasmBinary) {
229
- return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(function (module) {
210
+ return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(module => {
230
211
  return module.Graphviz.prototype.version();
231
212
  });
232
213
  }
233
- var graphviz = {
234
- layout: function (dotSource, outputFormat, layoutEngine, ext) {
235
- if (outputFormat === void 0) { outputFormat = "svg"; }
236
- if (layoutEngine === void 0) { layoutEngine = "dot"; }
214
+ const graphviz = {
215
+ layout(dotSource, outputFormat = "svg", layoutEngine = "dot", ext) {
237
216
  if (!dotSource)
238
217
  return Promise.resolve("");
239
- 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) {
240
- 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);
218
+ return loadWasm(graphvizlib$1, ext === null || ext === void 0 ? void 0 : ext.wasmFolder, ext === null || ext === void 0 ? void 0 : ext.wasmBinary).then(module => {
219
+ 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);
241
220
  createFiles(graphViz, ext);
242
- var retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
221
+ const retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
243
222
  module.destroy(graphViz);
244
223
  if (!retVal) {
245
224
  throw new Error(module.Graphviz.prototype.lastError());
@@ -247,93 +226,74 @@ var graphviz = {
247
226
  return retVal;
248
227
  });
249
228
  },
250
- circo: function (dotSource, outputFormat, ext) {
251
- if (outputFormat === void 0) { outputFormat = "svg"; }
229
+ circo(dotSource, outputFormat = "svg", ext) {
252
230
  return this.layout(dotSource, outputFormat, "circo", ext);
253
231
  },
254
- dot: function (dotSource, outputFormat, ext) {
255
- if (outputFormat === void 0) { outputFormat = "svg"; }
232
+ dot(dotSource, outputFormat = "svg", ext) {
256
233
  return this.layout(dotSource, outputFormat, "dot", ext);
257
234
  },
258
- fdp: function (dotSource, outputFormat, ext) {
259
- if (outputFormat === void 0) { outputFormat = "svg"; }
235
+ fdp(dotSource, outputFormat = "svg", ext) {
260
236
  return this.layout(dotSource, outputFormat, "fdp", ext);
261
237
  },
262
- sfdp: function (dotSource, outputFormat, ext) {
263
- if (outputFormat === void 0) { outputFormat = "svg"; }
238
+ sfdp(dotSource, outputFormat = "svg", ext) {
264
239
  return this.layout(dotSource, outputFormat, "sfdp", ext);
265
240
  },
266
- neato: function (dotSource, outputFormat, ext) {
267
- if (outputFormat === void 0) { outputFormat = "svg"; }
241
+ neato(dotSource, outputFormat = "svg", ext) {
268
242
  return this.layout(dotSource, outputFormat, "neato", ext);
269
243
  },
270
- osage: function (dotSource, outputFormat, ext) {
271
- if (outputFormat === void 0) { outputFormat = "svg"; }
244
+ osage(dotSource, outputFormat = "svg", ext) {
272
245
  return this.layout(dotSource, outputFormat, "osage", ext);
273
246
  },
274
- patchwork: function (dotSource, outputFormat, ext) {
275
- if (outputFormat === void 0) { outputFormat = "svg"; }
247
+ patchwork(dotSource, outputFormat = "svg", ext) {
276
248
  return this.layout(dotSource, outputFormat, "patchwork", ext);
277
249
  },
278
- twopi: function (dotSource, outputFormat, ext) {
279
- if (outputFormat === void 0) { outputFormat = "svg"; }
250
+ twopi(dotSource, outputFormat = "svg", ext) {
280
251
  return this.layout(dotSource, outputFormat, "twopi", ext);
281
252
  }
282
253
  };
283
- var GraphvizSync = /** @class */ (function () {
284
- function GraphvizSync(_wasm) {
254
+ class GraphvizSync {
255
+ constructor(_wasm) {
285
256
  this._wasm = _wasm;
286
257
  }
287
- GraphvizSync.prototype.layout = function (dotSource, outputFormat, layoutEngine, ext) {
288
- if (outputFormat === void 0) { outputFormat = "svg"; }
289
- if (layoutEngine === void 0) { layoutEngine = "dot"; }
258
+ layout(dotSource, outputFormat = "svg", layoutEngine = "dot", ext) {
290
259
  if (!dotSource)
291
260
  return "";
292
- 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);
261
+ 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);
293
262
  createFiles(graphViz, ext);
294
- var retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
263
+ const retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
295
264
  this._wasm.destroy(graphViz);
296
265
  if (!retVal) {
297
266
  throw new Error(this._wasm.Graphviz.prototype.lastError());
298
267
  }
299
268
  return retVal;
300
- };
301
- GraphvizSync.prototype.circo = function (dotSource, outputFormat, ext) {
302
- if (outputFormat === void 0) { outputFormat = "svg"; }
269
+ }
270
+ circo(dotSource, outputFormat = "svg", ext) {
303
271
  return this.layout(dotSource, outputFormat, "circo", ext);
304
- };
305
- GraphvizSync.prototype.dot = function (dotSource, outputFormat, ext) {
306
- if (outputFormat === void 0) { outputFormat = "svg"; }
272
+ }
273
+ dot(dotSource, outputFormat = "svg", ext) {
307
274
  return this.layout(dotSource, outputFormat, "dot", ext);
308
- };
309
- GraphvizSync.prototype.fdp = function (dotSource, outputFormat, ext) {
310
- if (outputFormat === void 0) { outputFormat = "svg"; }
275
+ }
276
+ fdp(dotSource, outputFormat = "svg", ext) {
311
277
  return this.layout(dotSource, outputFormat, "fdp", ext);
312
- };
313
- GraphvizSync.prototype.sfdp = function (dotSource, outputFormat, ext) {
314
- if (outputFormat === void 0) { outputFormat = "svg"; }
278
+ }
279
+ sfdp(dotSource, outputFormat = "svg", ext) {
315
280
  return this.layout(dotSource, outputFormat, "sfdp", ext);
316
- };
317
- GraphvizSync.prototype.neato = function (dotSource, outputFormat, ext) {
318
- if (outputFormat === void 0) { outputFormat = "svg"; }
281
+ }
282
+ neato(dotSource, outputFormat = "svg", ext) {
319
283
  return this.layout(dotSource, outputFormat, "neato", ext);
320
- };
321
- GraphvizSync.prototype.osage = function (dotSource, outputFormat, ext) {
322
- if (outputFormat === void 0) { outputFormat = "svg"; }
284
+ }
285
+ osage(dotSource, outputFormat = "svg", ext) {
323
286
  return this.layout(dotSource, outputFormat, "osage", ext);
324
- };
325
- GraphvizSync.prototype.patchwork = function (dotSource, outputFormat, ext) {
326
- if (outputFormat === void 0) { outputFormat = "svg"; }
287
+ }
288
+ patchwork(dotSource, outputFormat = "svg", ext) {
327
289
  return this.layout(dotSource, outputFormat, "patchwork", ext);
328
- };
329
- GraphvizSync.prototype.twopi = function (dotSource, outputFormat, ext) {
330
- if (outputFormat === void 0) { outputFormat = "svg"; }
290
+ }
291
+ twopi(dotSource, outputFormat = "svg", ext) {
331
292
  return this.layout(dotSource, outputFormat, "twopi", ext);
332
- };
333
- return GraphvizSync;
334
- }());
293
+ }
294
+ }
335
295
  function graphvizSync(wasmFolder, wasmBinary) {
336
- return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(function (wasm) { return new GraphvizSync(wasm); });
296
+ return loadWasm(graphvizlib$1, wasmFolder, wasmBinary).then(wasm => new GraphvizSync(wasm));
337
297
  }
338
298
 
339
299
  export { GraphvizSync, StackElement, StackParser, expatVersion, graphviz, graphvizSync, graphvizVersion, parse, wasmFolder };