Prechádzať zdrojové kódy

Found a different dom implementation that removes 6MB

Matt 6 rokov pred
rodič
commit
0019a4e1db

+ 4 - 0
package-lock.json

@@ -9250,6 +9250,10 @@
         }
         }
       }
       }
     },
     },
+    "nodom": {
+      "version": "github:ptytb/nodom#f041f9f85a6e21adb8e48273e6dd84474c773a01",
+      "from": "github:ptytb/nodom"
+    },
     "nomnom": {
     "nomnom": {
       "version": "1.5.2",
       "version": "1.5.2",
       "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz",
       "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz",

+ 1 - 0
package.json

@@ -121,6 +121,7 @@
     "ngeohash": "^0.6.3",
     "ngeohash": "^0.6.3",
     "node-forge": "^0.7.6",
     "node-forge": "^0.7.6",
     "node-md6": "^0.1.0",
     "node-md6": "^0.1.0",
+    "nodom": "github:ptytb/nodom",
     "notepack.io": "^2.2.0",
     "notepack.io": "^2.2.0",
     "nwmatcher": "^1.4.4",
     "nwmatcher": "^1.4.4",
     "otp": "^0.1.3",
     "otp": "^0.1.3",

+ 2 - 2
src/core/operations/HeatmapChart.mjs

@@ -5,7 +5,7 @@
  */
  */
 
 
 import * as d3 from "d3";
 import * as d3 from "d3";
-import jsdom from "jsdom";
+import * as nodom from "nodom";
 import { getScatterValues, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 import { getScatterValues, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 
 
 
 
@@ -117,7 +117,7 @@ class HeatmapChart extends Operation {
             yLabel = headings.y;
             yLabel = headings.y;
         }
         }
 
 
-        const document = new jsdom.JSDOM().window.document;
+        const document = new nodom.Document();
         let svg = document.createElement("svg");
         let svg = document.createElement("svg");
         svg = d3.select(svg)
         svg = d3.select(svg)
             .attr("width", "100%")
             .attr("width", "100%")

+ 2 - 2
src/core/operations/HexDensityChart.mjs

@@ -6,7 +6,7 @@
 
 
 import * as d3 from "d3";
 import * as d3 from "d3";
 import * as d3hexbin from "d3-hexbin";
 import * as d3hexbin from "d3-hexbin";
-import jsdom from "jsdom";
+import * as nodom from "nodom";
 import { getScatterValues, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 import { getScatterValues, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 
 
 import Operation from "../Operation";
 import Operation from "../Operation";
@@ -120,7 +120,7 @@ class HexDensityChart extends Operation {
             yLabel = headings.y;
             yLabel = headings.y;
         }
         }
 
 
-        const document = new jsdom.JSDOM().window.document;
+        const document = new nodom.Document();
         let svg = document.createElement("svg");
         let svg = document.createElement("svg");
         svg = d3.select(svg)
         svg = d3.select(svg)
             .attr("width", "100%")
             .attr("width", "100%")

+ 3 - 2
src/core/operations/ScatterChart.mjs

@@ -5,7 +5,7 @@
  */
  */
 
 
 import * as d3 from "d3";
 import * as d3 from "d3";
-import jsdom from "jsdom";
+import * as nodom from "nodom";
 import { getScatterValues, getScatterValuesWithColour, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 import { getScatterValues, getScatterValuesWithColour, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 
 
 import Operation from "../Operation";
 import Operation from "../Operation";
@@ -101,7 +101,8 @@ class ScatterChart extends Operation {
             xLabel = headings.x;
             xLabel = headings.x;
             yLabel = headings.y;
             yLabel = headings.y;
         }
         }
-        const document = new jsdom.JSDOM().window.document;
+
+        const document = new nodom.Document();
         let svg = document.createElement("svg");
         let svg = document.createElement("svg");
         svg = d3.select(svg)
         svg = d3.select(svg)
             .attr("width", "100%")
             .attr("width", "100%")

+ 2 - 2
src/core/operations/SeriesChart.mjs

@@ -5,7 +5,7 @@
  */
  */
 
 
 import * as d3 from "d3";
 import * as d3 from "d3";
-import jsdom from "jsdom";
+import * as nodom from "nodom";
 import { getSeriesValues, RECORD_DELIMITER_OPTIONS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 import { getSeriesValues, RECORD_DELIMITER_OPTIONS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
 
 
 import Operation from "../Operation";
 import Operation from "../Operation";
@@ -79,7 +79,7 @@ class SeriesChart extends Operation {
             allSeriesHeight = Object.keys(series).length * (interSeriesPadding + seriesHeight),
             allSeriesHeight = Object.keys(series).length * (interSeriesPadding + seriesHeight),
             svgHeight = allSeriesHeight + xAxisHeight + interSeriesPadding;
             svgHeight = allSeriesHeight + xAxisHeight + interSeriesPadding;
 
 
-        const document = new jsdom.JSDOM().window.document;
+        const document = new nodom.Document();
         let svg = document.createElement("svg");
         let svg = document.createElement("svg");
         svg = d3.select(svg)
         svg = d3.select(svg)
             .attr("width", "100%")
             .attr("width", "100%")