Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const typedoc = require('gulp-typedoc');

const pkg = require('./package.json');
const tsProject = typescript.createProject('./tsconfig.json');
const tsBuild = typescript.createProject('./tsconfig.build.json');

const argv = yargs
.option('verbose', {default: false})
Expand All @@ -27,7 +28,9 @@ const srcDir = './src/';
const outDir = './dist/';

gulp.task('bower', bowerTask);
gulp.task('build', buildTask);
gulp.task('buildjs', buildTask);
gulp.task('buildts', typescriptDefinitionsTask);
gulp.task('build', gulp.parallel('buildjs', 'buildts'));
gulp.task('package', packageTask);
gulp.task('lint-html', lintHtmlTask);
gulp.task('lint-js', lintJsTask);
Expand Down Expand Up @@ -135,6 +138,12 @@ function typescriptTask() {
.js.pipe(gulp.dest('dist'));
}

function typescriptDefinitionsTask() {
return tsBuild.src()
.pipe(tsBuild())
.js.pipe(gulp.dest('dist'));
}

function lintHtmlTask() {
return gulp.src('samples/**/*.html')
.pipe(htmllint({
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"bower.json",
"composer.json",
"dist/*.css",
"dist/*.js"
"dist/*.js",
"dist/types/**/*.d.ts"
],
"devDependencies": {
"@babel/core": "^7.8.4",
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function abstract() {
* @memberof Chart._adapters._date
*/

class DateAdapter {
export class DateAdapter {

constructor(options) {
this.options = options || {};
Expand Down
1 change: 1 addition & 0 deletions src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class Chart {
this._updating = false;
this.scales = {};
this.scale = undefined;
this.$plugins = undefined;

// Add the chart instance to the global namespace
Chart.instances[me.id] = me;
Expand Down
2 changes: 2 additions & 0 deletions src/core/core.plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class PluginService {
* Returns descriptors of enabled plugins for the given chart.
* @returns {object[]} [{ plugin, options }]
* @private
* @param {Chart} chart
*/
descriptors(chart) {
var cache = chart.$plugins || (chart.$plugins = {});
Expand Down Expand Up @@ -176,6 +177,7 @@ class PluginService {
* but in some cases, this reference can be changed by the user when updating options.
* https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
* @private
* @param {Chart} chart
*/
_invalidate(chart) {
delete chart.$plugins;
Expand Down
16 changes: 16 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "ES6",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"allowJs": true,
"checkJs": true,
"noEmit": false,
"declaration": true,
"declarationDir": "dist/types",
"emitDeclarationOnly": true
},
"include": [
"./src/**/*.js"
]
}