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