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