Replace viz.js v1.8.2 with @hpcc-js/wasm 0.3.14

Replace viz.js v1.8.2 with @hpcc-js/wasm 0.3.14

Thereby upgrading to Graphviz v2.44.0 which is currently the latest.

diff --git a/assets/javascripts/initializers/discourse-graphviz.js.es6 b/assets/javascripts/initializers/discourse-graphviz.js.es6
index b7db55a..ce723c6 100644
--- a/assets/javascripts/initializers/discourse-graphviz.js.es6
+++ b/assets/javascripts/initializers/discourse-graphviz.js.es6
@@ -24,24 +24,20 @@ export default {
     const $spinner = $("<div class='spinner tiny'></div>");
     $container.html($spinner);
 
-    loadScript("/plugins/discourse-graphviz/javascripts/viz-1.8.2.js").then(
+    loadScript("/plugins/discourse-graphviz/javascripts/@hpcc-js/wasm@0.3.14/dist/index.min.js").then(
       () => {
         $container.removeClass("is-loading");
 
-        try {
-          /* global Viz */
-          const svgChart = Viz(graphDefinition, {
-            format: "svg",
-            engine
-          });
+        let hpccWasm = self["@hpcc-js/wasm"];
+        hpccWasm.graphviz.layout(graphDefinition, "svg", engine).then((svgChart) => {
           $container.html(svgChart);
-        } catch (e) {
+        }).catch(e => {
           // graphviz error are unhelpful so we just show a default error
           const $error = $(
             "<div class='graph-error'>Error while rendering graph.</div>"
           );
           $container.html($error);
-        }
+        });
       }
     );
   },
diff --git a/plugin.rb b/plugin.rb
index a4cc1ce..6a324a6 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -14,7 +14,7 @@ after_initialize do
 
   def context
     context = MiniRacer::Context.new
-    context.load("#{Rails.root}/plugins/discourse-graphviz/public/javascripts/viz-1.8.2.js")
+    context.load("#{Rails.root}/plugins/discourse-graphviz/public/javascripts/@hpcc-js/wasm@0.3.14/dist/index.min.js")
     context
   end
 
diff --git a/public/javascripts/@hpcc-js/wasm@0.3.14/dist/graphvizlib.wasm b/public/javascripts/@hpcc-js/wasm@0.3.14/dist/graphvizlib.wasm
new file mode 100644
index 0000000..8499c32
Binary files /dev/null and b/public/javascripts/@hpcc-js/wasm@0.3.14/dist/graphvizlib.wasm differ
diff --git a/public/javascripts/@hpcc-js/wasm@0.3.14/dist/index.min.js b/public/javascripts/@hpcc-js/wasm@0.3.14/dist/index.min.js
new file mode 100644
index 0000000..202b30d
--- /dev/null
+++ b/public/javascripts/@hpcc-js/wasm@0.3.14/dist/index.min.js
@@ -0,0 +1 @@

[... diff too long, it was truncated ...]

GitHub sha: 38aef85c

This commit appears in #1 which was merged by SamSaffron.