@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.
@@ -47,10 +47,10 @@ module.exports = cpp;
47
47
 
48
48
  var expatlib_node = expatlib_node$1.exports;
49
49
 
50
- var expatlib = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
50
+ var expatlib = /*#__PURE__*/_mergeNamespaces({
51
51
  __proto__: null,
52
52
  'default': expatlib_node
53
- }, [expatlib_node$1.exports]));
53
+ }, [expatlib_node$1.exports]);
54
54
 
55
55
  function getGlobal() {
56
56
  if (typeof self !== "undefined") {
@@ -64,12 +64,12 @@ function getGlobal() {
64
64
  }
65
65
  throw new Error("unable to locate global object");
66
66
  }
67
- var globalNS = getGlobal();
68
- var _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
67
+ const globalNS = getGlobal();
68
+ let _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
69
69
  function wasmFolder(_) {
70
70
  if (!arguments.length)
71
71
  return _wasmFolder;
72
- var retVal = _wasmFolder;
72
+ const retVal = _wasmFolder;
73
73
  _wasmFolder = _;
74
74
  return retVal;
75
75
  }
@@ -86,13 +86,13 @@ function trimStart(str, charToRemove) {
86
86
  return str;
87
87
  }
88
88
  function loadWasm(_wasmLib, wf, wasmBinary) {
89
- var wasmLib = _wasmLib.default || _wasmLib;
89
+ const wasmLib = _wasmLib.default || _wasmLib;
90
90
  // Prevent double load ---
91
91
  if (!wasmLib.__hpcc_promise) {
92
92
  wasmLib.__hpcc_promise = wasmLib({
93
- wasmBinary: wasmBinary,
94
- locateFile: function (path, prefix) {
95
- return "".concat(trimEnd(wf || wasmFolder() || prefix || ".", "/"), "/").concat(trimStart(path, "/"));
93
+ wasmBinary,
94
+ locateFile: (path, prefix) => {
95
+ return `${trimEnd(wf || wasmFolder() || prefix || ".", "/")}/${trimStart(path, "/")}`;
96
96
  }
97
97
  });
98
98
  }
@@ -100,66 +100,60 @@ function loadWasm(_wasmLib, wf, wasmBinary) {
100
100
  }
101
101
 
102
102
  // @ts-ignore
103
- var StackElement = /** @class */ (function () {
104
- function StackElement(tag, attrs) {
103
+ class StackElement {
104
+ constructor(tag, attrs) {
105
105
  this.tag = tag;
106
106
  this.attrs = attrs;
107
107
  this._content = "";
108
108
  }
109
- Object.defineProperty(StackElement.prototype, "content", {
110
- get: function () {
111
- return this._content;
112
- },
113
- enumerable: false,
114
- configurable: true
115
- });
116
- StackElement.prototype.appendContent = function (content) {
109
+ get content() {
110
+ return this._content;
111
+ }
112
+ appendContent(content) {
117
113
  this._content += content;
118
- };
119
- return StackElement;
120
- }());
121
- var StackParser = /** @class */ (function () {
122
- function StackParser() {
114
+ }
115
+ }
116
+ class StackParser {
117
+ constructor() {
123
118
  this._stack = [];
124
119
  }
125
- StackParser.prototype.parse = function (xml, wasmFolder, wasmBinary) {
120
+ parse(xml, wasmFolder, wasmBinary) {
126
121
  return parse(xml, this, wasmFolder, wasmBinary);
127
- };
128
- StackParser.prototype.top = function () {
122
+ }
123
+ top() {
129
124
  return this._stack[this._stack.length - 1];
130
- };
131
- StackParser.prototype.startElement = function (tag, attrs) {
132
- var retVal = new StackElement(tag, attrs);
125
+ }
126
+ startElement(tag, attrs) {
127
+ const retVal = new StackElement(tag, attrs);
133
128
  this._stack.push(retVal);
134
129
  return retVal;
135
- };
136
- StackParser.prototype.endElement = function (tag) {
130
+ }
131
+ endElement(tag) {
137
132
  return this._stack.pop();
138
- };
139
- StackParser.prototype.characterData = function (content) {
133
+ }
134
+ characterData(content) {
140
135
  this.top().appendContent(content);
141
- };
142
- return StackParser;
143
- }());
136
+ }
137
+ }
144
138
  function parseAttrs(attrs) {
145
- var retVal = {};
146
- var keys = attrs;
147
- var sep = "".concat(String.fromCharCode(1));
148
- var sep2 = "".concat(sep).concat(sep);
149
- keys.split(sep2).filter(function (key) { return !!key; }).forEach(function (key) {
150
- var parts = key.split(sep);
139
+ const retVal = {};
140
+ const keys = attrs;
141
+ const sep = `${String.fromCharCode(1)}`;
142
+ const sep2 = `${sep}${sep}`;
143
+ keys.split(sep2).filter((key) => !!key).forEach((key) => {
144
+ const parts = key.split(sep);
151
145
  retVal[parts[0]] = parts[1];
152
146
  });
153
147
  return retVal;
154
148
  }
155
149
  function expatVersion(wasmFolder, wasmBinary) {
156
- return loadWasm(expatlib, wasmFolder, wasmBinary).then(function (module) {
150
+ return loadWasm(expatlib, wasmFolder, wasmBinary).then(module => {
157
151
  return module.CExpat.prototype.version();
158
152
  });
159
153
  }
160
154
  function parse(xml, callback, wasmFolder, wasmBinary) {
161
- return loadWasm(expatlib, wasmFolder, wasmBinary).then(function (module) {
162
- var parser = new module.CExpatJS();
155
+ return loadWasm(expatlib, wasmFolder, wasmBinary).then(module => {
156
+ const parser = new module.CExpatJS();
163
157
  parser.startElement = function () {
164
158
  callback.startElement(this.tag(), parseAttrs(this.attrs()));
165
159
  };
@@ -170,7 +164,7 @@ function parse(xml, callback, wasmFolder, wasmBinary) {
170
164
  callback.characterData(this.content());
171
165
  };
172
166
  parser.create();
173
- var retVal = parser.parse(xml);
167
+ const retVal = parser.parse(xml);
174
168
  parser.destroy();
175
169
  module.destroy(parser);
176
170
  return retVal;
@@ -199,59 +193,44 @@ module.exports = cpp;
199
193
 
200
194
  var graphvizlib_node = graphvizlib_node$1.exports;
201
195
 
202
- var graphvizlib = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
196
+ var graphvizlib = /*#__PURE__*/_mergeNamespaces({
203
197
  __proto__: null,
204
198
  'default': graphvizlib_node
205
- }, [graphvizlib_node$1.exports]));
199
+ }, [graphvizlib_node$1.exports]);
206
200
 
207
- var __assign = (undefined && undefined.__assign) || function () {
208
- __assign = Object.assign || function(t) {
209
- for (var s, i = 1, n = arguments.length; i < n; i++) {
210
- s = arguments[i];
211
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
212
- t[p] = s[p];
213
- }
214
- return t;
215
- };
216
- return __assign.apply(this, arguments);
217
- };
218
- var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
219
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
220
- if (ar || !(i in from)) {
221
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
222
- ar[i] = from[i];
223
- }
224
- }
225
- return to.concat(ar || Array.prototype.slice.call(from));
226
- };
201
+ // @ts-ignore
227
202
  function imageToFile(image) {
228
203
  return {
229
204
  path: image.path,
230
- 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>")
205
+ data: `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
206
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
207
+ <svg width="${image.width}" height="${image.height}"></svg>`
231
208
  };
232
209
  }
233
210
  function imagesToFiles(images) {
234
211
  return images.map(imageToFile);
235
212
  }
236
213
  function createFiles(graphviz, _ext) {
237
- var ext = __assign({ images: [], files: [] }, _ext);
238
- __spreadArray(__spreadArray([], ext.files, true), imagesToFiles(ext.images), true).forEach(function (file) { return graphviz.createFile(file.path, file.data); });
214
+ const ext = {
215
+ images: [],
216
+ files: [],
217
+ ..._ext
218
+ };
219
+ [...ext.files, ...imagesToFiles(ext.images)].forEach(file => graphviz.createFile(file.path, file.data));
239
220
  }
240
221
  function graphvizVersion(wasmFolder, wasmBinary) {
241
- return loadWasm(graphvizlib, wasmFolder, wasmBinary).then(function (module) {
222
+ return loadWasm(graphvizlib, wasmFolder, wasmBinary).then(module => {
242
223
  return module.Graphviz.prototype.version();
243
224
  });
244
225
  }
245
- var graphviz = {
246
- layout: function (dotSource, outputFormat, layoutEngine, ext) {
247
- if (outputFormat === void 0) { outputFormat = "svg"; }
248
- if (layoutEngine === void 0) { layoutEngine = "dot"; }
226
+ const graphviz = {
227
+ layout(dotSource, outputFormat = "svg", layoutEngine = "dot", ext) {
249
228
  if (!dotSource)
250
229
  return Promise.resolve("");
251
- return loadWasm(graphvizlib, ext === null || ext === void 0 ? void 0 : ext.wasmFolder, ext === null || ext === void 0 ? void 0 : ext.wasmBinary).then(function (module) {
252
- 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);
230
+ return loadWasm(graphvizlib, ext === null || ext === void 0 ? void 0 : ext.wasmFolder, ext === null || ext === void 0 ? void 0 : ext.wasmBinary).then(module => {
231
+ 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);
253
232
  createFiles(graphViz, ext);
254
- var retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
233
+ const retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
255
234
  module.destroy(graphViz);
256
235
  if (!retVal) {
257
236
  throw new Error(module.Graphviz.prototype.lastError());
@@ -259,93 +238,74 @@ var graphviz = {
259
238
  return retVal;
260
239
  });
261
240
  },
262
- circo: function (dotSource, outputFormat, ext) {
263
- if (outputFormat === void 0) { outputFormat = "svg"; }
241
+ circo(dotSource, outputFormat = "svg", ext) {
264
242
  return this.layout(dotSource, outputFormat, "circo", ext);
265
243
  },
266
- dot: function (dotSource, outputFormat, ext) {
267
- if (outputFormat === void 0) { outputFormat = "svg"; }
244
+ dot(dotSource, outputFormat = "svg", ext) {
268
245
  return this.layout(dotSource, outputFormat, "dot", ext);
269
246
  },
270
- fdp: function (dotSource, outputFormat, ext) {
271
- if (outputFormat === void 0) { outputFormat = "svg"; }
247
+ fdp(dotSource, outputFormat = "svg", ext) {
272
248
  return this.layout(dotSource, outputFormat, "fdp", ext);
273
249
  },
274
- sfdp: function (dotSource, outputFormat, ext) {
275
- if (outputFormat === void 0) { outputFormat = "svg"; }
250
+ sfdp(dotSource, outputFormat = "svg", ext) {
276
251
  return this.layout(dotSource, outputFormat, "sfdp", ext);
277
252
  },
278
- neato: function (dotSource, outputFormat, ext) {
279
- if (outputFormat === void 0) { outputFormat = "svg"; }
253
+ neato(dotSource, outputFormat = "svg", ext) {
280
254
  return this.layout(dotSource, outputFormat, "neato", ext);
281
255
  },
282
- osage: function (dotSource, outputFormat, ext) {
283
- if (outputFormat === void 0) { outputFormat = "svg"; }
256
+ osage(dotSource, outputFormat = "svg", ext) {
284
257
  return this.layout(dotSource, outputFormat, "osage", ext);
285
258
  },
286
- patchwork: function (dotSource, outputFormat, ext) {
287
- if (outputFormat === void 0) { outputFormat = "svg"; }
259
+ patchwork(dotSource, outputFormat = "svg", ext) {
288
260
  return this.layout(dotSource, outputFormat, "patchwork", ext);
289
261
  },
290
- twopi: function (dotSource, outputFormat, ext) {
291
- if (outputFormat === void 0) { outputFormat = "svg"; }
262
+ twopi(dotSource, outputFormat = "svg", ext) {
292
263
  return this.layout(dotSource, outputFormat, "twopi", ext);
293
264
  }
294
265
  };
295
- var GraphvizSync = /** @class */ (function () {
296
- function GraphvizSync(_wasm) {
266
+ class GraphvizSync {
267
+ constructor(_wasm) {
297
268
  this._wasm = _wasm;
298
269
  }
299
- GraphvizSync.prototype.layout = function (dotSource, outputFormat, layoutEngine, ext) {
300
- if (outputFormat === void 0) { outputFormat = "svg"; }
301
- if (layoutEngine === void 0) { layoutEngine = "dot"; }
270
+ layout(dotSource, outputFormat = "svg", layoutEngine = "dot", ext) {
302
271
  if (!dotSource)
303
272
  return "";
304
- 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);
273
+ 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);
305
274
  createFiles(graphViz, ext);
306
- var retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
275
+ const retVal = graphViz.layout(dotSource, outputFormat, layoutEngine);
307
276
  this._wasm.destroy(graphViz);
308
277
  if (!retVal) {
309
278
  throw new Error(this._wasm.Graphviz.prototype.lastError());
310
279
  }
311
280
  return retVal;
312
- };
313
- GraphvizSync.prototype.circo = function (dotSource, outputFormat, ext) {
314
- if (outputFormat === void 0) { outputFormat = "svg"; }
281
+ }
282
+ circo(dotSource, outputFormat = "svg", ext) {
315
283
  return this.layout(dotSource, outputFormat, "circo", ext);
316
- };
317
- GraphvizSync.prototype.dot = function (dotSource, outputFormat, ext) {
318
- if (outputFormat === void 0) { outputFormat = "svg"; }
284
+ }
285
+ dot(dotSource, outputFormat = "svg", ext) {
319
286
  return this.layout(dotSource, outputFormat, "dot", ext);
320
- };
321
- GraphvizSync.prototype.fdp = function (dotSource, outputFormat, ext) {
322
- if (outputFormat === void 0) { outputFormat = "svg"; }
287
+ }
288
+ fdp(dotSource, outputFormat = "svg", ext) {
323
289
  return this.layout(dotSource, outputFormat, "fdp", ext);
324
- };
325
- GraphvizSync.prototype.sfdp = function (dotSource, outputFormat, ext) {
326
- if (outputFormat === void 0) { outputFormat = "svg"; }
290
+ }
291
+ sfdp(dotSource, outputFormat = "svg", ext) {
327
292
  return this.layout(dotSource, outputFormat, "sfdp", ext);
328
- };
329
- GraphvizSync.prototype.neato = function (dotSource, outputFormat, ext) {
330
- if (outputFormat === void 0) { outputFormat = "svg"; }
293
+ }
294
+ neato(dotSource, outputFormat = "svg", ext) {
331
295
  return this.layout(dotSource, outputFormat, "neato", ext);
332
- };
333
- GraphvizSync.prototype.osage = function (dotSource, outputFormat, ext) {
334
- if (outputFormat === void 0) { outputFormat = "svg"; }
296
+ }
297
+ osage(dotSource, outputFormat = "svg", ext) {
335
298
  return this.layout(dotSource, outputFormat, "osage", ext);
336
- };
337
- GraphvizSync.prototype.patchwork = function (dotSource, outputFormat, ext) {
338
- if (outputFormat === void 0) { outputFormat = "svg"; }
299
+ }
300
+ patchwork(dotSource, outputFormat = "svg", ext) {
339
301
  return this.layout(dotSource, outputFormat, "patchwork", ext);
340
- };
341
- GraphvizSync.prototype.twopi = function (dotSource, outputFormat, ext) {
342
- if (outputFormat === void 0) { outputFormat = "svg"; }
302
+ }
303
+ twopi(dotSource, outputFormat = "svg", ext) {
343
304
  return this.layout(dotSource, outputFormat, "twopi", ext);
344
- };
345
- return GraphvizSync;
346
- }());
305
+ }
306
+ }
347
307
  function graphvizSync(wasmFolder, wasmBinary) {
348
- return loadWasm(graphvizlib, wasmFolder, wasmBinary).then(function (wasm) { return new GraphvizSync(wasm); });
308
+ return loadWasm(graphvizlib, wasmFolder, wasmBinary).then(wasm => new GraphvizSync(wasm));
349
309
  }
350
310
 
351
311
  exports.GraphvizSync = GraphvizSync;