@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.node.js
CHANGED
|
@@ -47,10 +47,10 @@ module.exports = cpp;
|
|
|
47
47
|
|
|
48
48
|
var expatlib_node = expatlib_node$1.exports;
|
|
49
49
|
|
|
50
|
-
var expatlib = /*#__PURE__*/
|
|
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
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
94
|
-
locateFile:
|
|
95
|
-
return
|
|
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
|
-
|
|
104
|
-
|
|
103
|
+
class StackElement {
|
|
104
|
+
constructor(tag, attrs) {
|
|
105
105
|
this.tag = tag;
|
|
106
106
|
this.attrs = attrs;
|
|
107
107
|
this._content = "";
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
function StackParser() {
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
class StackParser {
|
|
117
|
+
constructor() {
|
|
123
118
|
this._stack = [];
|
|
124
119
|
}
|
|
125
|
-
|
|
120
|
+
parse(xml, wasmFolder, wasmBinary) {
|
|
126
121
|
return parse(xml, this, wasmFolder, wasmBinary);
|
|
127
|
-
}
|
|
128
|
-
|
|
122
|
+
}
|
|
123
|
+
top() {
|
|
129
124
|
return this._stack[this._stack.length - 1];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
}
|
|
126
|
+
startElement(tag, attrs) {
|
|
127
|
+
const retVal = new StackElement(tag, attrs);
|
|
133
128
|
this._stack.push(retVal);
|
|
134
129
|
return retVal;
|
|
135
|
-
}
|
|
136
|
-
|
|
130
|
+
}
|
|
131
|
+
endElement(tag) {
|
|
137
132
|
return this._stack.pop();
|
|
138
|
-
}
|
|
139
|
-
|
|
133
|
+
}
|
|
134
|
+
characterData(content) {
|
|
140
135
|
this.top().appendContent(content);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}());
|
|
136
|
+
}
|
|
137
|
+
}
|
|
144
138
|
function parseAttrs(attrs) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
keys.split(sep2).filter(
|
|
150
|
-
|
|
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(
|
|
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(
|
|
162
|
-
|
|
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
|
-
|
|
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__*/
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
238
|
-
|
|
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(
|
|
222
|
+
return loadWasm(graphvizlib, wasmFolder, wasmBinary).then(module => {
|
|
242
223
|
return module.Graphviz.prototype.version();
|
|
243
224
|
});
|
|
244
225
|
}
|
|
245
|
-
|
|
246
|
-
layout
|
|
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(
|
|
252
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
296
|
-
|
|
266
|
+
class GraphvizSync {
|
|
267
|
+
constructor(_wasm) {
|
|
297
268
|
this._wasm = _wasm;
|
|
298
269
|
}
|
|
299
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
346
|
-
}());
|
|
305
|
+
}
|
|
306
|
+
}
|
|
347
307
|
function graphvizSync(wasmFolder, wasmBinary) {
|
|
348
|
-
return loadWasm(graphvizlib, wasmFolder, wasmBinary).then(
|
|
308
|
+
return loadWasm(graphvizlib, wasmFolder, wasmBinary).then(wasm => new GraphvizSync(wasm));
|
|
349
309
|
}
|
|
350
310
|
|
|
351
311
|
exports.GraphvizSync = GraphvizSync;
|