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