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