]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Provide auto-registering entry point (#8429)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sun, 28 Feb 2021 07:02:44 +0000 (09:02 +0200)
committerGitHub <noreply@github.com>
Sun, 28 Feb 2021 07:02:44 +0000 (09:02 +0200)
auto/auto.esm.d.ts [new file with mode: 0644]
auto/auto.esm.js [new file with mode: 0644]
auto/auto.js [new file with mode: 0644]
auto/package.json [new file with mode: 0644]
docs/docs/getting-started/integration.md
package.json

diff --git a/auto/auto.esm.d.ts b/auto/auto.esm.d.ts
new file mode 100644 (file)
index 0000000..d83b835
--- /dev/null
@@ -0,0 +1,4 @@
+import { Chart } from '../dist/chart.esm';
+
+export * from '../dist/chart.esm';
+export default Chart;
diff --git a/auto/auto.esm.js b/auto/auto.esm.js
new file mode 100644 (file)
index 0000000..f4b5711
--- /dev/null
@@ -0,0 +1,5 @@
+import {Chart, registrables} from '../dist/chart.esm';
+
+Chart.register(...registrables);
+
+export default Chart;
diff --git a/auto/auto.js b/auto/auto.js
new file mode 100644 (file)
index 0000000..235580f
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('../dist/chart');
diff --git a/auto/package.json b/auto/package.json
new file mode 100644 (file)
index 0000000..c2ad5b2
--- /dev/null
@@ -0,0 +1,8 @@
+{
+    "name": "chart.js-auto",
+    "private": true,
+    "description": "auto registering package",
+    "main": "auto.js",
+    "module": "auto.esm.js",
+    "types": "auto.esm.d.ts"
+}
index 690ec23168d47394117fe32327242a44f4d35949..d701d9d3ac729781c5e82f1c86fd09e8673b2e1b 100644 (file)
@@ -90,6 +90,12 @@ import { Chart, registerables } from 'chart.js';
 Chart.register(...registerables);
 ```
 
+And finally there is an separate path to do just the above for you, in one line:
+
+```javascript
+import Chart from 'chart.js/auto';
+```
+
 ## Require JS
 
 **Important:** RequireJS [can **not** load CommonJS module as is](https://requirejs.org/docs/commonjs.html#intro), so be sure to require one of the UMD builds instead (i.e. `dist/chart.js`, `dist/chart.min.js`, etc.).
index cf10f934ba518c539d610ea1411d1dc4c70bb4f3..6e0c84cad0bb8cb52b46371c9186391f03f3b7d6 100644 (file)
@@ -25,6 +25,8 @@
     "url": "https://github.com/chartjs/Chart.js/issues"
   },
   "files": [
+    "auto/**/*.js",
+    "auto/**/*.d.ts",
     "dist/*.js",
     "dist/*.d.ts",
     "dist/chunks/*.js",