Skip to content

Add strict partial bundles #5413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions dist/plotly-strict.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* plotly.js (strict) v2.0.0
* Copyright 2012-2021, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
6 changes: 6 additions & 0 deletions dist/plotly-strict.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* plotly.js (strict) v2.0.0
* Copyright 2012-2021, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
72 changes: 72 additions & 0 deletions lib/index-strict.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright 2012-2021, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

var Plotly = require('./core');

// traces
Plotly.register([
require('./bar'),
require('./box'),
require('./heatmap'),
require('./histogram'),
require('./histogram2d'),
require('./histogram2dcontour'),
require('./contour'),
require('./scatterternary'),
require('./violin'),
require('./funnel'),
require('./waterfall'),
require('./image'),

require('./pie'),
require('./sunburst'),
require('./treemap'),
require('./funnelarea'),

require('./scattergeo'),
require('./choropleth'),

require('./parcoords'),
require('./parcats'),

require('./scattermapbox'),
require('./choroplethmapbox'),
require('./densitymapbox'),

require('./sankey'),
require('./indicator'),

require('./table'),

require('./carpet'),
require('./scattercarpet'),
require('./contourcarpet'),

require('./ohlc'),
require('./candlestick'),

require('./scatterpolar'),
require('./barpolar')
]);

// transforms
Plotly.register([
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort')
]);

// components
Plotly.register([
require('./calendars')
]);

module.exports = Plotly;
2 changes: 2 additions & 0 deletions tasks/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ function getMainBundleInfo() {
'Starting in `v1.39.0`, each plotly.js partial bundle has a corresponding npm package with no dependencies.',
'',
'Starting in `v1.50.0`, the minified version of each partial bundle is also published to npm in a separate "dist min" package.',
'',
'Starting in `v2.0.0`, the strict partial bundle includes everything except the traces that require function constructor.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolaskruchten Do we want to add something like "Over time we hope to include more of the remaining trace types here, after which we intend to work on other strict CSP issues such as inline CSS that we may not be able to include in the main bundle."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, SGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcjohnson
Good call.
Done in c0a3d92.

''
];
}
Expand Down
2 changes: 1 addition & 1 deletion tasks/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ try {
}

var partialBundleNames = [
'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox', 'finance'
'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox', 'finance', 'strict'
];

var partialBundlePaths = partialBundleNames.map(function(name) {
Expand Down