Skip to content

Revise process of making bundles and simplify making partial bundles #5508

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 15 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from 12 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
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,9 @@ Then elsewhere in your code:
var Plotly = require('./path/to/custom-plotly');
```

#### Non-ascii characters
Alternatively you could browserify a custom bundle of desired trace modules e.g. `pie` and `choropleth` using
`npm run partial-bundle pie choropleth name=custom`
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice if this followed the usual command-line flag patterns and hence had --name=custom instead of just name=custom IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As a side note I don't want to rely on minimist; but OK I could look for --name when parsing the arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 8d902aa.


Important: the plotly.js code base contains some non-ascii characters. Therefore, please make sure to set the `charset` attribute to `"utf-8"` in the script tag that imports your plotly.js bundle. For example:

```html
<script src="my-plotly-bundle.js" charset="utf-8"></script>
```

## Building plotly.js

Expand Down
18 changes: 14 additions & 4 deletions lib/index-basic.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
'use strict';

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

Plotly.register([
core.register([
// traces
require('./bar'),
require('./pie')
require('./pie'),

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Personally it feels to me like this indirection makes things more confusing than the previous pattern - which with register_extra removed becomes just:

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

Plotly.register([...]);

module.exports = Plotly;

Is there another reason for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

register_extra file is not documented and confusing.
Until we could bump d3 (cc: #5112) or possibly release a @plotly/d3-v3 patch to fix unexpected characters at build time we need a function to the return correct result.

22 changes: 16 additions & 6 deletions lib/index-cartesian.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
'use strict';

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

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

Copy link
Contributor Author

@archmoj archmoj Feb 22, 2021

Choose a reason for hiding this comment

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

As you can see, image and pie used to be registered in a different order in cartesian bundles.

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
22 changes: 16 additions & 6 deletions lib/index-finance.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
'use strict';

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

Plotly.register([
core.register([
// traces
require('./bar'),
require('./histogram'),
require('./funnel'),
require('./waterfall'),
require('./pie'),
require('./funnelarea'),
require('./indicator'),
require('./ohlc'),
require('./candlestick'),
require('./funnel'),
require('./waterfall'),
require('./indicator')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you can see, funnel and waterfall and indicator used to be registered in a different order in finance bundles.


// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
18 changes: 14 additions & 4 deletions lib/index-geo.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
'use strict';

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

Plotly.register([
core.register([
// traces
require('./scattergeo'),
require('./choropleth')
require('./choropleth'),

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
18 changes: 14 additions & 4 deletions lib/index-gl2d.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
'use strict';

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

Plotly.register([
core.register([
// traces
require('./scattergl'),
require('./splom'),
require('./pointcloud'),
require('./heatmapgl'),
require('./parcoords')
require('./parcoords'),

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
20 changes: 15 additions & 5 deletions lib/index-gl3d.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
'use strict';

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

Plotly.register([
core.register([
// traces
require('./scatter3d'),
require('./surface'),
require('./mesh3d'),
require('./isosurface'),
require('./volume'),
require('./mesh3d'),
require('./cone'),
require('./streamtube')
require('./streamtube'),

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
18 changes: 14 additions & 4 deletions lib/index-mapbox.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
'use strict';

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

Plotly.register([
core.register([
// traces
require('./scattermapbox'),
require('./choroplethmapbox'),
require('./densitymapbox')
require('./densitymapbox'),

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
29 changes: 14 additions & 15 deletions lib/index-strict.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

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

// traces
Plotly.register([
core.register([
// traces
require('./bar'),
require('./box'),
require('./heatmap'),
Expand All @@ -16,40 +16,39 @@ Plotly.register([
require('./funnel'),
require('./waterfall'),
require('./image'),

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

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

require('./scattergl'),
require('./splom'),

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('./scatterpolargl'),
require('./barpolar')
require('./barpolar'),

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
32 changes: 14 additions & 18 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

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

// traces
Plotly.register([
core.register([
// traces
require('./bar'),
require('./box'),
require('./heatmap'),
Expand All @@ -16,52 +16,48 @@ Plotly.register([
require('./funnel'),
require('./waterfall'),
require('./image'),

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

require('./scatter3d'),
require('./surface'),
require('./isosurface'),
require('./volume'),
require('./mesh3d'),
require('./cone'),
require('./streamtube'),

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

require('./scattergl'),
require('./splom'),

require('./pointcloud'),
require('./heatmapgl'),

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('./scatterpolargl'),
require('./barpolar')
require('./barpolar'),

// transforms
require('./aggregate'),
require('./filter'),
require('./groupby'),
require('./sort'),

// components
require('./calendars')
]);

module.exports = require('./register_extra')(Plotly);
module.exports = (function(Plotly) { return Plotly; })(core);
27 changes: 0 additions & 27 deletions lib/register_extra.js

This file was deleted.

Loading