You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2024/09/10 02:37:56 UTC

(echarts-custom-series) branch main updated: chore: update rollup config

This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/echarts-custom-series.git


The following commit(s) were added to refs/heads/main by this push:
     new e5de49d  chore: update rollup config
e5de49d is described below

commit e5de49d70dfacecdfebdec849656f925649eebd5
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Sep 10 10:37:44 2024 +0800

    chore: update rollup config
---
 custom-series/violin/dist/index.js                 |   3 -
 custom-series/violin/dist/index.min.js             |   2 +-
 custom-series/violin/dist/index.min.js.map         |   2 +-
 custom-series/violin/rollup.config.js              |   7 +-
 package-lock.json                                  | 173 +++++++++++++++++++++
 package.json                                       |   1 +
 scripts/serve.js                                   |  92 +++++++++++
 .../violin => scripts/template}/rollup.config.js   |   4 +-
 8 files changed, 272 insertions(+), 12 deletions(-)

diff --git a/custom-series/violin/dist/index.js b/custom-series/violin/dist/index.js
index 76b122b..7d4520f 100644
--- a/custom-series/violin/dist/index.js
+++ b/custom-series/violin/dist/index.js
@@ -135,6 +135,3 @@
     return index;
 
 }));
-if (typeof window !== 'undefined') {
-  window.violinCustomSeriesInstaller = violinCustomSeriesInstaller;
-}
diff --git a/custom-series/violin/dist/index.min.js b/custom-series/violin/dist/index.min.js
index 7240598..b4900dd 100644
--- a/custom-series/violin/dist/index.min.js
+++ b/custom-series/violin/dist/index.min.js
@@ -16,4 +16,4 @@
 * specific language governing permissions and limitations
 * under the License.
 */
-!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).violinCustomSeriesInstaller=n()}(this,(function(){"use strict";function e(e){return Math.abs(e)<=1?.75*(1-e*e):0}var n=function(n,t){var i={};if(null==n.context.violins){n.context.violins=[],i=n.context.violins;for(var l=n.dataInsideLength,o=0;o<l;++o){var a=t.value(0,o);null==i[a]&&(i[a]={firstDataInd [...]
\ No newline at end of file
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).violinCustomSeriesInstaller=t()}(this,(function(){"use strict";function e(e){return Math.abs(e)<=1?.75*(1-e*e):0}var t=function(t,n){var l={};if(null==t.context.violins){t.context.violins=[],l=t.context.violins;for(var o=t.dataInsideLength,i=0;i<o;++i){var a=n.value(0,i);null==l[a]&&(l[a]={firstDataInd [...]
\ No newline at end of file
diff --git a/custom-series/violin/dist/index.min.js.map b/custom-series/violin/dist/index.min.js.map
index 590c690..8f276c5 100644
--- a/custom-series/violin/dist/index.min.js.map
+++ b/custom-series/violin/dist/index.min.js.map
@@ -1 +1 @@
-{"version":3,"names":["global","factory","exports","module","define","amd","globalThis","self","violinCustomSeriesInstaller","this","epanechnikovKernel","u","Math","abs","renderItem","params","api","violins","context","cnt","dataInsideLength","i_1","xIndex","value","firstDataIndex","data","push","kernel","bandwidth","symbolSize","itemPayload","xValue","yValue","coord","bandWidthScale","bandWidth","violin","violinPath","dataIndex","kde_1","x","sum","i","length","binCount","xRange","densit [...]
\ No newline at end of file
+{"version":3,"names":["global","factory","exports","module","define","amd","globalThis","self","violinCustomSeriesInstaller","this","epanechnikovKernel","u","Math","abs","renderItem","params","api","violins","context","cnt","dataInsideLength","i_1","xIndex","value","firstDataIndex","data","push","kernel","bandwidth","symbolSize","itemPayload","xValue","yValue","coord","bandWidthScale","bandWidth","violin","violinPath","dataIndex","kde_1","x","sum","i","length","binCount","xRange","densit [...]
\ No newline at end of file
diff --git a/custom-series/violin/rollup.config.js b/custom-series/violin/rollup.config.js
index a1cdfb6..3f099d3 100644
--- a/custom-series/violin/rollup.config.js
+++ b/custom-series/violin/rollup.config.js
@@ -11,7 +11,7 @@ module.exports = {
   },
   plugins: [
     {
-      name: 'add-window-assignment',
+      name: 'add-license',
       renderChunk(code) {
         return `/*
 * Licensed to the Apache Software Foundation (ASF) under one
@@ -31,10 +31,7 @@ module.exports = {
 * specific language governing permissions and limitations
 * under the License.
 */
-${code}
-if (typeof window !== 'undefined') {
-  window.violinCustomSeriesInstaller = violinCustomSeriesInstaller;
-}`;
+${code}`;
       },
     },
   ],
diff --git a/package-lock.json b/package-lock.json
index 9920b3d..f385c3b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
       "version": "1.0.0",
       "license": "Apache-2.0",
       "devDependencies": {
+        "chokidar": "^3.6.0",
         "http-server": "^14.1.1",
         "rollup": "^4.21.2",
         "terser": "^5.31.6",
@@ -314,6 +315,19 @@
         "url": "https://github.com/chalk/ansi-styles?sponsor=1"
       }
     },
+    "node_modules/anymatch": {
+      "version": "3.1.3",
+      "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+      "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+      "dev": true,
+      "dependencies": {
+        "normalize-path": "^3.0.0",
+        "picomatch": "^2.0.4"
+      },
+      "engines": {
+        "node": ">= 8"
+      }
+    },
     "node_modules/async": {
       "version": "2.6.4",
       "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
@@ -335,6 +349,30 @@
         "node": ">= 0.8"
       }
     },
+    "node_modules/binary-extensions": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
+      "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
+      "dev": true,
+      "engines": {
+        "node": ">=8"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
+    "node_modules/braces": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+      "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+      "dev": true,
+      "dependencies": {
+        "fill-range": "^7.1.1"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
     "node_modules/buffer-from": {
       "version": "1.1.2",
       "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@@ -376,6 +414,30 @@
         "url": "https://github.com/chalk/chalk?sponsor=1"
       }
     },
+    "node_modules/chokidar": {
+      "version": "3.6.0",
+      "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
+      "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
+      "dev": true,
+      "dependencies": {
+        "anymatch": "~3.1.2",
+        "braces": "~3.0.2",
+        "glob-parent": "~5.1.2",
+        "is-binary-path": "~2.1.0",
+        "is-glob": "~4.0.1",
+        "normalize-path": "~3.0.0",
+        "readdirp": "~3.6.0"
+      },
+      "engines": {
+        "node": ">= 8.10.0"
+      },
+      "funding": {
+        "url": "https://paulmillr.com/funding/"
+      },
+      "optionalDependencies": {
+        "fsevents": "~2.3.2"
+      }
+    },
     "node_modules/color-convert": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -462,6 +524,18 @@
       "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
       "dev": true
     },
+    "node_modules/fill-range": {
+      "version": "7.1.1",
+      "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+      "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+      "dev": true,
+      "dependencies": {
+        "to-regex-range": "^5.0.1"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
     "node_modules/follow-redirects": {
       "version": "1.15.9",
       "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
@@ -524,6 +598,18 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
+    "node_modules/glob-parent": {
+      "version": "5.1.2",
+      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+      "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+      "dev": true,
+      "dependencies": {
+        "is-glob": "^4.0.1"
+      },
+      "engines": {
+        "node": ">= 6"
+      }
+    },
     "node_modules/gopd": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
@@ -667,6 +753,48 @@
         "node": ">=0.10.0"
       }
     },
+    "node_modules/is-binary-path": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+      "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+      "dev": true,
+      "dependencies": {
+        "binary-extensions": "^2.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/is-extglob": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+      "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-glob": {
+      "version": "4.0.3",
+      "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+      "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+      "dev": true,
+      "dependencies": {
+        "is-extglob": "^2.1.1"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-number": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+      "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.12.0"
+      }
+    },
     "node_modules/lodash": {
       "version": "4.17.21",
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
@@ -712,6 +840,15 @@
       "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
       "dev": true
     },
+    "node_modules/normalize-path": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+      "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
     "node_modules/object-inspect": {
       "version": "1.13.2",
       "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
@@ -733,6 +870,18 @@
         "opener": "bin/opener-bin.js"
       }
     },
+    "node_modules/picomatch": {
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+      "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+      "dev": true,
+      "engines": {
+        "node": ">=8.6"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/jonschlinkert"
+      }
+    },
     "node_modules/portfinder": {
       "version": "1.0.32",
       "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz",
@@ -762,6 +911,18 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
+    "node_modules/readdirp": {
+      "version": "3.6.0",
+      "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+      "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+      "dev": true,
+      "dependencies": {
+        "picomatch": "^2.2.1"
+      },
+      "engines": {
+        "node": ">=8.10.0"
+      }
+    },
     "node_modules/requires-port": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
@@ -905,6 +1066,18 @@
         "node": ">=10"
       }
     },
+    "node_modules/to-regex-range": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+      "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+      "dev": true,
+      "dependencies": {
+        "is-number": "^7.0.0"
+      },
+      "engines": {
+        "node": ">=8.0"
+      }
+    },
     "node_modules/typescript": {
       "version": "5.5.4",
       "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
diff --git a/package.json b/package.json
index e623038..712954d 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
   },
   "homepage": "https://github.com/apache/echarts-custom-series#readme",
   "devDependencies": {
+    "chokidar": "^3.6.0",
     "http-server": "^14.1.1",
     "rollup": "^4.21.2",
     "terser": "^5.31.6",
diff --git a/scripts/serve.js b/scripts/serve.js
new file mode 100644
index 0000000..f9c309b
--- /dev/null
+++ b/scripts/serve.js
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const path = require('path');
+const fs = require('fs');
+const { exec } = require('child_process');
+const chokidar = require('chokidar');
+
+/**
+ * Start a local server to run the test cases.
+ */
+function serve() {
+  const args = process.argv.slice(2);
+  if (args.length === 0) {
+    console.error(
+      'No custom series name provided. Run `npm run serve <series-name>` to serve a custom series.'
+    );
+    return;
+  }
+
+  const seriesPath = path.join(__dirname, '../custom-series', args[0]);
+  if (!fs.existsSync(seriesPath)) {
+    console.error(`Custom series ${args[0]} does not exist`);
+    return;
+  }
+
+  const port = 8080;
+  const serverProcess = exec(`http-server ${seriesPath} -p ${port}`);
+
+  // Add file watcher
+  const watcher = chokidar.watch(path.join(seriesPath, 'src'), {
+    ignored: /(^|[\/\\])\../, // ignore dotfiles
+    persistent: true,
+  });
+
+  watcher.on('change', (path) => {
+    console.log(`File ${path} has been changed. Rebuilding...`);
+    exec(`npm run build ${args[0]}`, (error, stdout, stderr) => {
+      if (error) {
+        console.error(`Build error: ${error}`);
+        return;
+      }
+      console.log(`Build output: ${stdout}`);
+      if (stderr) {
+        console.error(`Build stderr: ${stderr}`);
+      }
+    });
+  });
+
+  serverProcess.stdout.on('data', (data) => {
+    if (data.includes('Available on:')) {
+      const open =
+        process.platform === 'darwin'
+          ? 'open'
+          : process.platform === 'win32'
+          ? 'start'
+          : 'xdg-open';
+      const url = `http://localhost:${port}/test/index.html`;
+      exec(`${open} ${url}`, (error) => {
+        if (error) {
+          console.error(`Failed to open browser: ${error}`);
+        }
+      });
+    }
+  });
+
+  serverProcess.stderr.on('data', (data) => {
+    console.error(data.toString());
+  });
+
+  serverProcess.on('close', (code) => {
+    console.log(`http-server process exited with code ${code}`);
+  });
+}
+
+serve();
diff --git a/custom-series/violin/rollup.config.js b/scripts/template/rollup.config.js
similarity index 89%
copy from custom-series/violin/rollup.config.js
copy to scripts/template/rollup.config.js
index a1cdfb6..fb381b8 100644
--- a/custom-series/violin/rollup.config.js
+++ b/scripts/template/rollup.config.js
@@ -3,7 +3,7 @@ module.exports = {
   output: {
     file: 'dist/index.js',
     format: 'umd',
-    name: 'violinCustomSeriesInstaller',
+    name: '$CUSTOM_SERIES_NAME$CustomSeriesInstaller',
     extend: true,
     globals: {
       window: 'window',
@@ -33,7 +33,7 @@ module.exports = {
 */
 ${code}
 if (typeof window !== 'undefined') {
-  window.violinCustomSeriesInstaller = violinCustomSeriesInstaller;
+  window.$CUSTOM_SERIES_NAME$CustomSeriesInstaller = violinCustomSeriesInstaller;
 }`;
       },
     },


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org