Skip to content

Commit e1dd72b

Browse files
authored
Merge pull request #5865 from plotly/strict-devtool
Excluding regl based traces from the strict bundle
2 parents b3bff15 + 21fab9a commit e1dd72b

File tree

8 files changed

+41
-15
lines changed

8 files changed

+41
-15
lines changed

Diff for: devtools/test_dashboard/index-strict.html

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Security-Policy" content="script-src 'self'; worker-src blob:; ">
5+
<title>Plotly.js "strict" Devtools</title>
6+
7+
<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"/>
8+
<link rel="stylesheet" type="text/css" href="./style.css">
9+
</head>
10+
<body>
11+
<header>
12+
<img src="http://images.plot.ly/logo/[email protected]" onClick="Tabs.reload();" />
13+
<span id="reload-time"></span>
14+
15+
<input id="mocks-search" type="text" placeholder="mocks search" />
16+
</header>
17+
18+
<section id="mocks-list"></section>
19+
<div id="plots">
20+
<div id="graph"></div>
21+
</div>
22+
<div id="snapshot"></div>
23+
24+
<script src="../../node_modules/mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>
25+
<script charset="utf-8" id="source" src="../../build/plotly.js"></script>
26+
<script charset="utf-8" src="../../build/test_dashboard-bundle.js"></script>
27+
</body>
28+
</html>

Diff for: devtools/test_dashboard/server.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ var http = require('http');
44
var ecstatic = require('ecstatic');
55
var open = require('open');
66
var browserify = require('browserify');
7+
var minimist = require('minimist');
78

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

12-
var PORT = process.argv[2] || 3000;
13-
13+
var args = minimist(process.argv.slice(2), {});
14+
var PORT = args.port || 3000;
15+
var strict = args.strict;
1416

1517
// Create server
1618
var server = http.createServer(ecstatic({
@@ -21,9 +23,9 @@ var server = http.createServer(ecstatic({
2123
}));
2224

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

2931
// Bundle devtools code

Diff for: draftlogs/5865_fix.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Do not include `parcoords`, `splom`, `scattergl` and `scatterpolargl` in the "strict" bundle [[#5865](https://github.com/plotly/plotly.js/pull/5865)]

Diff for: lib/index-strict.js

-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ Plotly.register([
2323
require('./funnelarea'),
2424
require('./scattergeo'),
2525
require('./choropleth'),
26-
require('./scattergl'),
27-
require('./splom'),
28-
require('./parcoords'),
2926
require('./parcats'),
3027
require('./scattermapbox'),
3128
require('./choroplethmapbox'),
@@ -39,7 +36,6 @@ Plotly.register([
3936
require('./ohlc'),
4037
require('./candlestick'),
4138
require('./scatterpolar'),
42-
require('./scatterpolargl'),
4339
require('./barpolar'),
4440

4541
// transforms

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"test-requirejs": "node tasks/test_requirejs.js",
5252
"test-plain-obj": "node tasks/test_plain_obj.js",
5353
"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",
54+
"strict": "node devtools/test_dashboard/server.js --strict",
5455
"start": "node devtools/test_dashboard/server.js",
5556
"baseline": "node test/image/make_baseline.js",
5657
"noci-baseline": "npm run cibuild && ./tasks/noci_test.sh image && git checkout dist && echo 'Please do not commit unless the change was expected!'",

Diff for: tasks/util/constants.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function startsWithLowerCase(v) {
1717
}
1818

1919
var pathToPlotlyIndex = path.join(pathToLib, 'index.js');
20+
var pathToPlotlyStrict = path.join(pathToLib, 'index-strict.js');
2021
var mainIndex = fs.readFileSync(pathToPlotlyIndex, 'utf-8');
2122
var allTraces = fs.readdirSync(path.join(pathToSrc, 'traces'))
2223
.filter(startsWithLowerCase);
@@ -128,18 +129,14 @@ var partialBundleTraces = {
128129
'indicator',
129130
'ohlc',
130131
'parcats',
131-
'parcoords',
132132
'pie',
133133
'sankey',
134134
'scatter',
135135
'scattercarpet',
136136
'scattergeo',
137-
'scattergl',
138137
'scattermapbox',
139138
'scatterpolar',
140-
'scatterpolargl',
141139
'scatterternary',
142-
'splom',
143140
'sunburst',
144141
'table',
145142
'treemap',
@@ -179,6 +176,7 @@ module.exports = {
179176
allTraces: allTraces,
180177
mainIndex: mainIndex,
181178
pathToPlotlyIndex: pathToPlotlyIndex,
179+
pathToPlotlyStrict: pathToPlotlyStrict,
182180
pathToPlotlyCore: path.join(pathToSrc, 'core.js'),
183181
pathToPlotlyVersion: path.join(pathToSrc, 'version.js'),
184182
pathToPlotlyBuild: path.join(pathToBuild, 'plotly.js'),

Diff for: tasks/util/watchified_bundle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ var common = require('./common');
1717
* @param {function} onFirstBundleCallback executed when first bundle is completed
1818
*
1919
*/
20-
module.exports = function makeWatchifiedBundle(onFirstBundleCallback) {
21-
var b = browserify(constants.pathToPlotlyIndex, {
20+
module.exports = function makeWatchifiedBundle(strict, onFirstBundleCallback) {
21+
var b = browserify(strict ? constants.pathToPlotlyStrict : constants.pathToPlotlyIndex, {
2222
debug: true,
2323
standalone: 'Plotly',
2424
ignoreTransform: './tasks/compress_attributes.js',

Diff for: tasks/watch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ var makeWatchifiedBundle = require('./util/watchified_bundle');
22
var noop = function() {};
33

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

0 commit comments

Comments
 (0)