Skip to content
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

Excluding regl based traces from the strict bundle #5865

Merged
merged 3 commits into from
Jul 30, 2021
Merged
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
28 changes: 28 additions & 0 deletions devtools/test_dashboard/index-strict.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'self'; worker-src blob:; ">
<title>Plotly.js "strict" Devtools</title>

<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Droid+Sans|PT+Sans+Narrow|Gravitas+One|Droid+Sans+Mono|Droid+Serif|Raleway|Old+Standard+TT"/>
<link rel="stylesheet" type="text/css" href="./style.css">
</head>
<body>
<header>
<img src="http://images.plot.ly/logo/[email protected]" onClick="Tabs.reload();" />
<span id="reload-time"></span>

<input id="mocks-search" type="text" placeholder="mocks search" />
</header>

<section id="mocks-list"></section>
<div id="plots">
<div id="graph"></div>
</div>
<div id="snapshot"></div>

<script src="../../node_modules/mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script charset="utf-8" id="source" src="../../build/plotly.js"></script>
<script charset="utf-8" src="../../build/test_dashboard-bundle.js"></script>
</body>
</html>
10 changes: 6 additions & 4 deletions devtools/test_dashboard/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ var http = require('http');
var ecstatic = require('ecstatic');
var open = require('open');
var browserify = require('browserify');
var minimist = require('minimist');

var constants = require('../../tasks/util/constants');
var makeWatchifiedBundle = require('../../tasks/util/watchified_bundle');
var shortcutPaths = require('../../tasks/util/shortcut_paths');

var PORT = process.argv[2] || 3000;

var args = minimist(process.argv.slice(2), {});
var PORT = args.port || 3000;
var strict = args.strict;

// Create server
var server = http.createServer(ecstatic({
Expand All @@ -21,9 +23,9 @@ var server = http.createServer(ecstatic({
}));

// Make watchified bundle for plotly.js
var bundlePlotly = makeWatchifiedBundle(function() {
var bundlePlotly = makeWatchifiedBundle(strict, function() {
// open up browser window on first bundle callback
open('http://localhost:' + PORT + '/devtools/test_dashboard/index.html');
open('http://localhost:' + PORT + '/devtools/test_dashboard/index' + (strict ? '-strict' : '') + '.html');
});

// Bundle devtools code
Expand Down
1 change: 1 addition & 0 deletions draftlogs/5865_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Do not include `parcoords`, `splom`, `scattergl` and `scatterpolargl` in the "strict" bundle [[#5865](https://github.com/plotly/plotly.js/pull/5865)]
4 changes: 0 additions & 4 deletions lib/index-strict.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ Plotly.register([
require('./funnelarea'),
require('./scattergeo'),
require('./choropleth'),
require('./scattergl'),
require('./splom'),
require('./parcoords'),
require('./parcats'),
require('./scattermapbox'),
require('./choroplethmapbox'),
Expand All @@ -39,7 +36,6 @@ Plotly.register([
require('./ohlc'),
require('./candlestick'),
require('./scatterpolar'),
require('./scatterpolargl'),
require('./barpolar'),

// transforms
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"test-requirejs": "node tasks/test_requirejs.js",
"test-plain-obj": "node tasks/test_plain_obj.js",
"test": "npm run test-jasmine -- --nowatch && npm run test-bundle && npm run test-image && npm run test-export && npm run test-syntax && npm run lint",
"strict": "node devtools/test_dashboard/server.js --strict",
"start": "node devtools/test_dashboard/server.js",
"baseline": "node test/image/make_baseline.js",
"noci-baseline": "npm run cibuild && ./tasks/noci_test.sh image && git checkout dist && echo 'Please do not commit unless the change was expected!'",
Expand Down
6 changes: 2 additions & 4 deletions tasks/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function startsWithLowerCase(v) {
}

var pathToPlotlyIndex = path.join(pathToLib, 'index.js');
var pathToPlotlyStrict = path.join(pathToLib, 'index-strict.js');
var mainIndex = fs.readFileSync(pathToPlotlyIndex, 'utf-8');
var allTraces = fs.readdirSync(path.join(pathToSrc, 'traces'))
.filter(startsWithLowerCase);
Expand Down Expand Up @@ -128,18 +129,14 @@ var partialBundleTraces = {
'indicator',
'ohlc',
'parcats',
'parcoords',
'pie',
'sankey',
'scatter',
'scattercarpet',
'scattergeo',
'scattergl',
'scattermapbox',
'scatterpolar',
'scatterpolargl',
'scatterternary',
'splom',
'sunburst',
'table',
'treemap',
Expand Down Expand Up @@ -179,6 +176,7 @@ module.exports = {
allTraces: allTraces,
mainIndex: mainIndex,
pathToPlotlyIndex: pathToPlotlyIndex,
pathToPlotlyStrict: pathToPlotlyStrict,
pathToPlotlyCore: path.join(pathToSrc, 'core.js'),
pathToPlotlyVersion: path.join(pathToSrc, 'version.js'),
pathToPlotlyBuild: path.join(pathToBuild, 'plotly.js'),
Expand Down
4 changes: 2 additions & 2 deletions tasks/util/watchified_bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var common = require('./common');
* @param {function} onFirstBundleCallback executed when first bundle is completed
*
*/
module.exports = function makeWatchifiedBundle(onFirstBundleCallback) {
var b = browserify(constants.pathToPlotlyIndex, {
module.exports = function makeWatchifiedBundle(strict, onFirstBundleCallback) {
var b = browserify(strict ? constants.pathToPlotlyStrict : constants.pathToPlotlyIndex, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Non-blocking, but do we actually want the strict dashboard to use the strict bundle? I'd kind of think we want the full bundle there, or at least have that capability, in order to test which of the full set of traces and features work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That could become an option to 'npm start'.

debug: true,
standalone: 'Plotly',
ignoreTransform: './tasks/compress_attributes.js',
Expand Down
2 changes: 1 addition & 1 deletion tasks/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ var makeWatchifiedBundle = require('./util/watchified_bundle');
var noop = function() {};

// make a watchified bundle for plotly.js and run it!
var watchifiedBundle = makeWatchifiedBundle(noop);
var watchifiedBundle = makeWatchifiedBundle(false, noop);
watchifiedBundle();