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