From bfdf6a3d6cbec9faf78bb08a4bdaedef117be875 Mon Sep 17 00:00:00 2001 From: Cameron DeCoster Date: Wed, 29 Apr 2026 14:13:04 -0600 Subject: [PATCH 1/3] Remove unused/unneeded depedencies --- package-lock.json | 157 +++++----------------------------------------- package.json | 8 --- 2 files changed, 15 insertions(+), 150 deletions(-) diff --git a/package-lock.json b/package-lock.json index dda6542210f..96146b19689 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,10 +18,7 @@ "@turf/bbox": "^7.1.0", "@turf/centroid": "^7.1.0", "base64-arraybuffer": "^1.0.2", - "canvas-fit": "^1.5.0", - "color-alpha": "1.0.4", "color-normalize": "1.5.0", - "color-parse": "2.0.0", "color-rgba": "3.0.0", "country-regex": "^1.1.0", "d3-force": "^1.2.1", @@ -39,9 +36,7 @@ "has-passive-events": "^1.0.0", "is-mobile": "^4.0.0", "maplibre-gl": "^4.7.1", - "mouse-change": "^1.4.0", "mouse-event-offset": "^3.0.2", - "mouse-wheel": "^1.2.0", "native-promise-only": "^0.8.1", "parse-svg-path": "^0.1.2", "point-in-polygon": "^1.1.0", @@ -52,10 +47,8 @@ "regl-scatter2d": "^3.3.1", "regl-splom": "^1.0.14", "strongly-connected-components": "^1.0.1", - "superscript-text": "^1.0.0", "svg-path-sdf": "^1.1.3", "tinycolor2": "^1.4.2", - "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", "world-calendars": "^1.0.4" @@ -104,7 +97,6 @@ "minify-stream": "^2.1.0", "npm-link-check": "^5.0.1", "pixelmatch": "^7.1.0", - "prepend-file": "^2.0.1", "prettysize": "^2.0.0", "raw-loader": "^4.0.2", "read-last-lines": "^1.8.0", @@ -2575,14 +2567,6 @@ "node": "^18.12.0 || >= 20.9.0" } }, - "node_modules/canvas-fit": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.5.0.tgz", - "integrity": "sha1-rhO+Zq3kL1vg5IfjRfzjCl5bXl8=", - "dependencies": { - "element-size": "^1.1.1" - } - }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -3951,11 +3935,6 @@ "license": "ISC", "peer": true }, - "node_modules/element-size": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/element-size/-/element-size-1.1.1.tgz", - "integrity": "sha1-ZOXxWdlxIWMYRby67K8nnDm1404=" - }, "node_modules/elementary-circuits-directed-graph": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/elementary-circuits-directed-graph/-/elementary-circuits-directed-graph-1.2.0.tgz", @@ -6131,15 +6110,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", @@ -6995,21 +6965,6 @@ "sourcemap-codec": "^1.4.4" } }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/map-limit": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/map-limit/-/map-limit-0.0.1.tgz", @@ -7423,34 +7378,11 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/mouse-change": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/mouse-change/-/mouse-change-1.4.0.tgz", - "integrity": "sha1-wrd+W/o0pDzhRFyBV6Tk3JiVwU8=", - "dependencies": { - "mouse-event": "^1.0.0" - } - }, - "node_modules/mouse-event": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/mouse-event/-/mouse-event-1.0.5.tgz", - "integrity": "sha1-s3ie23EJmX1aky0dAdqhVDpQFzI=" - }, "node_modules/mouse-event-offset": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/mouse-event-offset/-/mouse-event-offset-3.0.2.tgz", "integrity": "sha1-39hqbiSMa6jK1TuQXVA3ogY+mYQ=" }, - "node_modules/mouse-wheel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mouse-wheel/-/mouse-wheel-1.2.0.tgz", - "integrity": "sha1-bSkDseqPtI5h8bU7kDZ3PwQs21w=", - "dependencies": { - "right-now": "^1.0.0", - "signum": "^1.0.0", - "to-px": "^1.0.1" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -7482,9 +7414,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", - "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "dev": true, "funding": [ { @@ -7492,6 +7424,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -8223,9 +8156,9 @@ "integrity": "sha512-ziHW/02J0XuNuUtmidBc6GXE8YohYydp3DWPWXYsd7O721TjcmN+k6ezjdwkDqep+gnWnFY+yqZHvzElra2oCg==" }, "node_modules/postcss": { - "version": "8.4.41", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.41.tgz", - "integrity": "sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==", + "version": "8.5.12", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.12.tgz", + "integrity": "sha512-W62t/Se6rA0Az3DfCL0AqJwXuKwBeYg6nOaIgzP+xZ7N5BFCI7DYi1qs6ygUYT6rvfi6t9k65UMLJC+PHZpDAA==", "dev": true, "funding": [ { @@ -8241,10 +8174,11 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -8423,18 +8357,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prepend-file": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/prepend-file/-/prepend-file-2.0.1.tgz", - "integrity": "sha512-0hXWjmOpz5YBIk6xujS0lYtCw6IAA0wCR3fw49UGTLc3E9BIhcxgqdMa8rzGvrtt2F8wFiGP42oEpQ8fo9zhRw==", - "dev": true, - "dependencies": { - "temp-write": "^4.0.0" - }, - "engines": { - "node": "^10.17 || >=11.14" - } - }, "node_modules/pretty-ms": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", @@ -8986,11 +8908,6 @@ "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", "dev": true }, - "node_modules/right-now": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/right-now/-/right-now-1.0.0.tgz", - "integrity": "sha1-bolgne69fc2vja7Mmuo5z1haCRg=" - }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -9344,11 +9261,6 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, - "node_modules/signum": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/signum/-/signum-1.0.0.tgz", - "integrity": "sha1-dKfSvyogtA66FqkrFSEk8dVZ+nc=" - }, "node_modules/simple-concat": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", @@ -9514,10 +9426,11 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -9866,11 +9779,6 @@ "kdbush": "^3.0.0" } }, - "node_modules/superscript-text": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/superscript-text/-/superscript-text-1.0.0.tgz", - "integrity": "sha1-58snUlZzYN9QvrBhDOjfPXHY39g=" - }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -10042,31 +9950,6 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/temp-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", - "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/temp-write": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/temp-write/-/temp-write-4.0.0.tgz", - "integrity": "sha512-HIeWmj77uOOHb0QX7siN3OtwV3CTntquin6TNVg6SHOqCP3hYKmox90eeFOGaY1MqJ9WYDDjkyZrW6qS5AWpbw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.15", - "is-stream": "^2.0.0", - "make-dir": "^3.0.0", - "temp-dir": "^1.0.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/terser": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.1.tgz", @@ -10731,16 +10614,6 @@ "node": ">= 0.4.0" } }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "dev": true, - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/package.json b/package.json index d978be4acfb..090084619af 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,7 @@ "@turf/bbox": "^7.1.0", "@turf/centroid": "^7.1.0", "base64-arraybuffer": "^1.0.2", - "canvas-fit": "^1.5.0", - "color-alpha": "1.0.4", "color-normalize": "1.5.0", - "color-parse": "2.0.0", "color-rgba": "3.0.0", "country-regex": "^1.1.0", "d3-force": "^1.2.1", @@ -97,9 +94,7 @@ "has-passive-events": "^1.0.0", "is-mobile": "^4.0.0", "maplibre-gl": "^4.7.1", - "mouse-change": "^1.4.0", "mouse-event-offset": "^3.0.2", - "mouse-wheel": "^1.2.0", "native-promise-only": "^0.8.1", "parse-svg-path": "^0.1.2", "point-in-polygon": "^1.1.0", @@ -110,10 +105,8 @@ "regl-scatter2d": "^3.3.1", "regl-splom": "^1.0.14", "strongly-connected-components": "^1.0.1", - "superscript-text": "^1.0.0", "svg-path-sdf": "^1.1.3", "tinycolor2": "^1.4.2", - "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", "world-calendars": "^1.0.4" @@ -162,7 +155,6 @@ "minify-stream": "^2.1.0", "npm-link-check": "^5.0.1", "pixelmatch": "^7.1.0", - "prepend-file": "^2.0.1", "prettysize": "^2.0.0", "raw-loader": "^4.0.2", "read-last-lines": "^1.8.0", From 2f367caffdf8ca2377f860f52b7ea456dff18bf1 Mon Sep 17 00:00:00 2001 From: Cameron DeCoster Date: Wed, 29 Apr 2026 14:13:12 -0600 Subject: [PATCH 2/3] Linting/formatting --- tasks/util/common.js | 82 ++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/tasks/util/common.js b/tasks/util/common.js index e6b648ee86a..bec88f83978 100644 --- a/tasks/util/common.js +++ b/tasks/util/common.js @@ -6,53 +6,53 @@ function _throw(err) { throw err; } -exports.execCmd = function(cmd, cb, errorCb) { - cb = cb ? cb : function() {}; - errorCb = errorCb ? errorCb : function(err) { if(err) _throw(err); }; - - exec(cmd, function(err) { +exports.execCmd = function (cmd, cb, errorCb) { + cb = cb ? cb : function () {}; + errorCb = errorCb + ? errorCb + : function (err) { + if (err) _throw(err); + }; + + exec(cmd, function (err) { errorCb(err); cb(); - }) - .stdout.pipe(process.stdout); + }).stdout.pipe(process.stdout); }; -exports.writeFile = function(filePath, content, cb) { - fs.writeFile(filePath, content, function(err) { - if(err) _throw(err); - if(cb) cb(); +exports.writeFile = function (filePath, content, cb) { + fs.writeFile(filePath, content, function (err) { + if (err) _throw(err); + if (cb) cb(); }); }; -exports.doesDirExist = function(dirPath) { +exports.doesDirExist = function (dirPath) { try { - if(fs.statSync(dirPath).isDirectory()) return true; - } catch(e) { + if (fs.statSync(dirPath).isDirectory()) return true; + } catch (e) { return false; } return false; }; -exports.doesFileExist = function(filePath) { +exports.doesFileExist = function (filePath) { try { - if(fs.statSync(filePath).isFile()) return true; - } catch(e) { + if (fs.statSync(filePath).isFile()) return true; + } catch (e) { return false; } return false; }; -exports.formatTime = function(date) { - return [ - date.toLocaleDateString(), - date.toLocaleTimeString() - ].join(' '); +exports.formatTime = function (date) { + return [date.toLocaleDateString(), date.toLocaleTimeString()].join(' '); }; -exports.getTimeLastModified = function(filePath) { - if(!exports.doesFileExist(filePath)) { +exports.getTimeLastModified = function (filePath) { + if (!exports.doesFileExist(filePath)) { throw new Error(filePath + ' does not exist'); } @@ -62,32 +62,32 @@ exports.getTimeLastModified = function(filePath) { return formattedTime; }; -exports.touch = function(filePath) { +exports.touch = function (filePath) { fs.closeSync(fs.openSync(filePath, 'w')); }; -exports.throwOnError = function(err) { - if(err) _throw(err); +exports.throwOnError = function (err) { + if (err) _throw(err); }; -exports.formatEnumeration = function(list) { +exports.formatEnumeration = function (list) { var len = list.length; - return list.map(function(l, i) { - var ending; + return list + .map(function (l, i) { + var ending; - if(i === len - 2) ending = ' and'; - else if(i < len - 1) ending = ','; - else ending = ''; + if (i === len - 2) ending = ' and'; + else if (i < len - 1) ending = ','; + else ending = ''; - return '`' + l + '`' + ending; - }).join(' '); + return '`' + l + '`' + ending; + }) + .join(' '); }; -exports.hasJasmineTestTag = function(node, tag) { - var re = tag ? - new RegExp('@' + tag + '\\s') : - new RegExp('@' + '\\w'); +exports.hasJasmineTestTag = function (node, tag) { + var re = tag ? new RegExp('@' + tag + '\\s') : new RegExp('@' + '\\w'); return re.test(node.source()); }; @@ -103,10 +103,10 @@ function isJasmineBase(block, node, tag) { ); } -exports.isJasmineTestIt = function(node, tag) { +exports.isJasmineTestIt = function (node, tag) { return isJasmineBase('it', node, tag); }; -exports.isJasmineTestDescribe = function(node, tag) { +exports.isJasmineTestDescribe = function (node, tag) { return isJasmineBase('describe', node, tag); }; From c1b7f2c87296043add4d8a8831000863ad22de6e Mon Sep 17 00:00:00 2001 From: Cameron DeCoster Date: Wed, 29 Apr 2026 14:13:56 -0600 Subject: [PATCH 3/3] Use local utility for prepend file --- tasks/bundle.mjs | 13 ++++++------- tasks/partial_bundle.mjs | 6 ++---- tasks/util/bundle_wrapper.mjs | 6 ++---- tasks/util/common.js | 5 +++++ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tasks/bundle.mjs b/tasks/bundle.mjs index 5ff76c5df68..4c4c1d62e2d 100644 --- a/tasks/bundle.mjs +++ b/tasks/bundle.mjs @@ -1,5 +1,4 @@ import runSeries from 'run-series'; -import prependFile from 'prepend-file'; import constants from './util/constants.js'; import common from './util/common.js'; @@ -35,7 +34,7 @@ var tasks = []; tasks.push(function(done) { _bundle(pathToPlotlyIndex, pathToPlotlyDist, { }, function() { - prependFile.sync(pathToPlotlyDist, header, common.throwOnError); + common.prependFile(pathToPlotlyDist, header); done(); }); @@ -46,7 +45,7 @@ tasks.push(function(done) { _bundle(pathToPlotlyIndex, pathToPlotlyDistMin, { minify: true, }, function() { - prependFile.sync(pathToPlotlyDistMin, header, common.throwOnError); + common.prependFile(pathToPlotlyDistMin, header); done(); }); @@ -56,7 +55,7 @@ tasks.push(function(done) { tasks.push(function(done) { _bundle(pathToPlotlyStrict, pathToPlotlyStrictDist, { }, function() { - prependFile.sync(pathToPlotlyStrictDist, header.replace('plotly.js', 'plotly.js (strict)'), common.throwOnError); + common.prependFile(pathToPlotlyStrictDist, header.replace('plotly.js', 'plotly.js (strict)')); done(); }); @@ -67,7 +66,7 @@ tasks.push(function(done) { _bundle(pathToPlotlyStrict, pathToPlotlyStrictDistMin, { minify: true, }, function() { - prependFile.sync(pathToPlotlyStrictDistMin, header.replace('plotly.js', 'plotly.js (strict - minified)'), common.throwOnError); + common.prependFile(pathToPlotlyStrictDistMin, header.replace('plotly.js', 'plotly.js (strict - minified)')); done(); }); @@ -79,7 +78,7 @@ tasks.push(function(done) { noPlugins: true, standalone: 'PlotlyGeoAssets' }, function() { - prependFile.sync(pathToPlotlyGeoAssetsDist, header, common.throwOnError); + common.prependFile(pathToPlotlyGeoAssetsDist, header); done(); }); @@ -90,7 +89,7 @@ tasks.push(function(done) { _bundle(pathToPlotlyIndex, pathToPlotlyDistWithMeta, { noCompressAttributes: true }, function() { - prependFile.sync(pathToPlotlyDistWithMeta, header, common.throwOnError); + common.prependFile(pathToPlotlyDistWithMeta, header); done(); }); diff --git a/tasks/partial_bundle.mjs b/tasks/partial_bundle.mjs index 09c8ea0bfff..ad4f0149d08 100644 --- a/tasks/partial_bundle.mjs +++ b/tasks/partial_bundle.mjs @@ -1,5 +1,3 @@ -import prependFile from 'prepend-file'; - import constants from './util/constants.js'; import common from './util/common.js'; import _bundle from './util/bundle_wrapper.mjs'; @@ -59,7 +57,7 @@ export default function partialBundle(tasks, opts) { _bundle(index, dist, bundleOpts, function() { var headerDist = header.replace('plotly.js', 'plotly.js (' + name + ')'); - if(dist) prependFile.sync(dist, headerDist, common.throwOnError); + if(dist) common.prependFile(dist, headerDist); done(); }); @@ -74,7 +72,7 @@ export default function partialBundle(tasks, opts) { _bundle(index, distMin, bundleOpts, function() { var headerDistMin = header.replace('plotly.js', 'plotly.js (' + name + ' - minified)'); - if(distMin) prependFile.sync(distMin, headerDistMin, common.throwOnError); + if(distMin) common.prependFile(distMin, headerDistMin); done(); }); diff --git a/tasks/util/bundle_wrapper.mjs b/tasks/util/bundle_wrapper.mjs index a4cb0d43e62..b7ad0cc776d 100644 --- a/tasks/util/bundle_wrapper.mjs +++ b/tasks/util/bundle_wrapper.mjs @@ -1,6 +1,5 @@ import fs from 'fs'; import fsExtra from 'fs-extra'; -import prependFile from 'prepend-file'; import { build } from 'esbuild'; @@ -51,7 +50,7 @@ export default async function _bundle(pathToIndex, pathToBundle, opts, cb) { // Until https://github.com/evanw/esbuild/pull/513 is merged // Thanks to https://github.com/prantlf and https://github.com/birkskyum function addWrapper(path) { - prependFile.sync( + common.prependFile( path, [ '(', @@ -63,8 +62,7 @@ function addWrapper(path) { ' }', '} (typeof self !== "undefined" ? self : this, () => {', '' - ].join('\n'), - common.throwOnError + ].join('\n') ); fsExtra.appendFile(path, ['', 'window.Plotly = Plotly;', 'return Plotly;', '}));'].join('\n'), common.throwOnError); diff --git a/tasks/util/common.js b/tasks/util/common.js index bec88f83978..52153c4bb27 100644 --- a/tasks/util/common.js +++ b/tasks/util/common.js @@ -70,6 +70,11 @@ exports.throwOnError = function (err) { if (err) _throw(err); }; +exports.prependFile = (filePath, content) => { + const existing = fs.readFileSync(filePath, 'utf8'); + fs.writeFileSync(filePath, content + existing); +}; + exports.formatEnumeration = function (list) { var len = list.length;