From 4bbe89a6bc7d421e9522959bf93398c1df47f582 Mon Sep 17 00:00:00 2001 From: archmoj Date: Tue, 16 Feb 2021 10:18:44 -0500 Subject: [PATCH 01/15] rewrite code to generate partial bundles - simplify lib folder and generate index files for partial bundles in build - remove confusing dev flags from dist bundle - make a separate script for partial bundles - integrate header_dist into bundle tasks --- lib/aggregate.js | 3 - lib/bar.js | 3 - lib/barpolar.js | 3 - lib/box.js | 3 - lib/calendars.js | 3 - lib/candlestick.js | 3 - lib/carpet.js | 3 - lib/choropleth.js | 3 - lib/choroplethmapbox.js | 3 - lib/cone.js | 3 - lib/contour.js | 3 - lib/contourcarpet.js | 3 - lib/core.js | 3 - lib/densitymapbox.js | 3 - lib/filter.js | 3 - lib/funnel.js | 3 - lib/funnelarea.js | 3 - lib/groupby.js | 3 - lib/heatmap.js | 3 - lib/heatmapgl.js | 3 - lib/histogram.js | 3 - lib/histogram2d.js | 3 - lib/histogram2dcontour.js | 3 - lib/image.js | 3 - lib/index-basic.js | 10 -- lib/index-cartesian.js | 19 --- lib/index-finance.js | 17 --- lib/index-geo.js | 10 -- lib/index-gl2d.js | 13 -- lib/index-gl3d.js | 15 --- lib/index-mapbox.js | 11 -- lib/index-strict.js | 55 --------- lib/index.js | 114 ++++++++---------- lib/indicator.js | 3 - lib/isosurface.js | 3 - lib/mesh3d.js | 3 - lib/ohlc.js | 3 - lib/parcats.js | 3 - lib/parcoords.js | 3 - lib/pie.js | 3 - lib/pointcloud.js | 3 - lib/register_extra.js | 27 ----- lib/sankey.js | 3 - lib/scatter.js | 3 - lib/scatter3d.js | 3 - lib/scattercarpet.js | 3 - lib/scattergeo.js | 3 - lib/scattergl.js | 3 - lib/scattermapbox.js | 3 - lib/scatterpolar.js | 3 - lib/scatterpolargl.js | 3 - lib/scatterternary.js | 3 - lib/sort.js | 3 - lib/splom.js | 3 - lib/streamtube.js | 3 - lib/sunburst.js | 3 - lib/surface.js | 3 - lib/table.js | 3 - lib/treemap.js | 3 - lib/violin.js | 3 - lib/volume.js | 3 - lib/waterfall.js | 3 - package.json | 4 +- tasks/bundle.js | 72 ++++++----- tasks/header_dist.js | 33 ----- tasks/partial_bundle.js | 61 ++++++++++ tasks/stats.js | 4 +- tasks/sync_packages.js | 4 +- tasks/util/common.js | 36 ------ tasks/util/constants.js | 105 +++++++++++++++- test/jasmine/assets/supply_defaults.js | 2 +- test/jasmine/bundle_tests/bar_test.js | 4 +- test/jasmine/bundle_tests/choropleth_test.js | 4 +- .../bundle_tests/component_first_test.js | 10 +- .../bundle_tests/component_last_test.js | 10 +- test/jasmine/bundle_tests/contour_test.js | 4 +- test/jasmine/bundle_tests/core_test.js | 2 +- .../bundle_tests/dynamic_import_test.js | 4 +- test/jasmine/bundle_tests/finance_test.js | 6 +- .../bundle_tests/histogram2dcontour_test.js | 6 +- test/jasmine/bundle_tests/no_webgl_test.js | 2 +- test/jasmine/tests/barpolar_test.js | 2 +- test/jasmine/tests/box_test.js | 2 +- test/jasmine/tests/choropleth_test.js | 2 +- test/jasmine/tests/choroplethmapbox_test.js | 2 +- test/jasmine/tests/colorscale_test.js | 2 +- test/jasmine/tests/cone_test.js | 2 +- test/jasmine/tests/densitymapbox_test.js | 2 +- .../jasmine/tests/domain_ref_interact_test.js | 7 +- test/jasmine/tests/domain_ref_test.js | 2 +- test/jasmine/tests/isosurface_test.js | 2 +- test/jasmine/tests/lib_test.js | 2 +- test/jasmine/tests/localize_test.js | 2 +- test/jasmine/tests/mapbox_test.js | 2 +- test/jasmine/tests/mesh3d_test.js | 2 +- test/jasmine/tests/page_test.js | 2 +- test/jasmine/tests/polar_test.js | 2 +- test/jasmine/tests/range_selector_test.js | 2 +- test/jasmine/tests/scattergeo_test.js | 2 +- test/jasmine/tests/scattermapbox_test.js | 2 +- test/jasmine/tests/scatterpolar_test.js | 2 +- test/jasmine/tests/scatterpolargl_test.js | 2 +- test/jasmine/tests/scatterternary_test.js | 2 +- test/jasmine/tests/sliders_test.js | 2 +- test/jasmine/tests/splom_test.js | 2 +- test/jasmine/tests/streamtube_test.js | 2 +- test/jasmine/tests/sunburst_test.js | 2 +- test/jasmine/tests/ternary_test.js | 2 +- test/jasmine/tests/toimage_test.js | 2 +- test/jasmine/tests/transform_filter_test.js | 2 +- test/jasmine/tests/transform_multi_test.js | 2 +- test/jasmine/tests/treemap_test.js | 2 +- test/jasmine/tests/updatemenus_test.js | 2 +- test/jasmine/tests/violin_test.js | 2 +- test/jasmine/tests/volume_test.js | 2 +- 115 files changed, 321 insertions(+), 572 deletions(-) delete mode 100644 lib/aggregate.js delete mode 100644 lib/bar.js delete mode 100644 lib/barpolar.js delete mode 100644 lib/box.js delete mode 100644 lib/calendars.js delete mode 100644 lib/candlestick.js delete mode 100644 lib/carpet.js delete mode 100644 lib/choropleth.js delete mode 100644 lib/choroplethmapbox.js delete mode 100644 lib/cone.js delete mode 100644 lib/contour.js delete mode 100644 lib/contourcarpet.js delete mode 100644 lib/core.js delete mode 100644 lib/densitymapbox.js delete mode 100644 lib/filter.js delete mode 100644 lib/funnel.js delete mode 100644 lib/funnelarea.js delete mode 100644 lib/groupby.js delete mode 100644 lib/heatmap.js delete mode 100644 lib/heatmapgl.js delete mode 100644 lib/histogram.js delete mode 100644 lib/histogram2d.js delete mode 100644 lib/histogram2dcontour.js delete mode 100644 lib/image.js delete mode 100644 lib/index-basic.js delete mode 100644 lib/index-cartesian.js delete mode 100644 lib/index-finance.js delete mode 100644 lib/index-geo.js delete mode 100644 lib/index-gl2d.js delete mode 100644 lib/index-gl3d.js delete mode 100644 lib/index-mapbox.js delete mode 100644 lib/index-strict.js delete mode 100644 lib/indicator.js delete mode 100644 lib/isosurface.js delete mode 100644 lib/mesh3d.js delete mode 100644 lib/ohlc.js delete mode 100644 lib/parcats.js delete mode 100644 lib/parcoords.js delete mode 100644 lib/pie.js delete mode 100644 lib/pointcloud.js delete mode 100644 lib/register_extra.js delete mode 100644 lib/sankey.js delete mode 100644 lib/scatter.js delete mode 100644 lib/scatter3d.js delete mode 100644 lib/scattercarpet.js delete mode 100644 lib/scattergeo.js delete mode 100644 lib/scattergl.js delete mode 100644 lib/scattermapbox.js delete mode 100644 lib/scatterpolar.js delete mode 100644 lib/scatterpolargl.js delete mode 100644 lib/scatterternary.js delete mode 100644 lib/sort.js delete mode 100644 lib/splom.js delete mode 100644 lib/streamtube.js delete mode 100644 lib/sunburst.js delete mode 100644 lib/surface.js delete mode 100644 lib/table.js delete mode 100644 lib/treemap.js delete mode 100644 lib/violin.js delete mode 100644 lib/volume.js delete mode 100644 lib/waterfall.js delete mode 100644 tasks/header_dist.js create mode 100644 tasks/partial_bundle.js diff --git a/lib/aggregate.js b/lib/aggregate.js deleted file mode 100644 index a076feab6c5..00000000000 --- a/lib/aggregate.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/transforms/aggregate'); diff --git a/lib/bar.js b/lib/bar.js deleted file mode 100644 index 53397793ff9..00000000000 --- a/lib/bar.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/bar'); diff --git a/lib/barpolar.js b/lib/barpolar.js deleted file mode 100644 index 5791f600e7c..00000000000 --- a/lib/barpolar.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/barpolar'); diff --git a/lib/box.js b/lib/box.js deleted file mode 100644 index 4fc66201240..00000000000 --- a/lib/box.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/box'); diff --git a/lib/calendars.js b/lib/calendars.js deleted file mode 100644 index f197dad6716..00000000000 --- a/lib/calendars.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/components/calendars'); diff --git a/lib/candlestick.js b/lib/candlestick.js deleted file mode 100644 index 438d3eaf22e..00000000000 --- a/lib/candlestick.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/candlestick'); diff --git a/lib/carpet.js b/lib/carpet.js deleted file mode 100644 index cbc90b5c201..00000000000 --- a/lib/carpet.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/carpet'); diff --git a/lib/choropleth.js b/lib/choropleth.js deleted file mode 100644 index 6fc96766e81..00000000000 --- a/lib/choropleth.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/choropleth'); diff --git a/lib/choroplethmapbox.js b/lib/choroplethmapbox.js deleted file mode 100644 index eebd007f658..00000000000 --- a/lib/choroplethmapbox.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/choroplethmapbox'); diff --git a/lib/cone.js b/lib/cone.js deleted file mode 100644 index 63b1b490ff0..00000000000 --- a/lib/cone.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/cone'); diff --git a/lib/contour.js b/lib/contour.js deleted file mode 100644 index 3ed8332b64a..00000000000 --- a/lib/contour.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/contour'); diff --git a/lib/contourcarpet.js b/lib/contourcarpet.js deleted file mode 100644 index e5d16e9b71d..00000000000 --- a/lib/contourcarpet.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/contourcarpet'); diff --git a/lib/core.js b/lib/core.js deleted file mode 100644 index 75182f42c07..00000000000 --- a/lib/core.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/core'); diff --git a/lib/densitymapbox.js b/lib/densitymapbox.js deleted file mode 100644 index 6607531c90b..00000000000 --- a/lib/densitymapbox.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/densitymapbox'); diff --git a/lib/filter.js b/lib/filter.js deleted file mode 100644 index f53c81505c3..00000000000 --- a/lib/filter.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/transforms/filter'); diff --git a/lib/funnel.js b/lib/funnel.js deleted file mode 100644 index 434e1cc99ad..00000000000 --- a/lib/funnel.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/funnel'); diff --git a/lib/funnelarea.js b/lib/funnelarea.js deleted file mode 100644 index e10ce6ec6ca..00000000000 --- a/lib/funnelarea.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/funnelarea'); diff --git a/lib/groupby.js b/lib/groupby.js deleted file mode 100644 index ca5334865b6..00000000000 --- a/lib/groupby.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/transforms/groupby'); diff --git a/lib/heatmap.js b/lib/heatmap.js deleted file mode 100644 index 668e97c3fc6..00000000000 --- a/lib/heatmap.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/heatmap'); diff --git a/lib/heatmapgl.js b/lib/heatmapgl.js deleted file mode 100644 index 04be0e5ad86..00000000000 --- a/lib/heatmapgl.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/heatmapgl'); diff --git a/lib/histogram.js b/lib/histogram.js deleted file mode 100644 index 5468e89a96f..00000000000 --- a/lib/histogram.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/histogram'); diff --git a/lib/histogram2d.js b/lib/histogram2d.js deleted file mode 100644 index 3cb6bc5c680..00000000000 --- a/lib/histogram2d.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/histogram2d'); diff --git a/lib/histogram2dcontour.js b/lib/histogram2dcontour.js deleted file mode 100644 index a8afc916ce3..00000000000 --- a/lib/histogram2dcontour.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/histogram2dcontour'); diff --git a/lib/image.js b/lib/image.js deleted file mode 100644 index 12c4105394c..00000000000 --- a/lib/image.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/image'); diff --git a/lib/index-basic.js b/lib/index-basic.js deleted file mode 100644 index cb2ed7fd10d..00000000000 --- a/lib/index-basic.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var Plotly = require('./core'); - -Plotly.register([ - require('./bar'), - require('./pie') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index-cartesian.js b/lib/index-cartesian.js deleted file mode 100644 index 09d9e693d5c..00000000000 --- a/lib/index-cartesian.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -var Plotly = require('./core'); - -Plotly.register([ - require('./bar'), - require('./box'), - require('./heatmap'), - require('./histogram'), - require('./histogram2d'), - require('./histogram2dcontour'), - require('./image'), - require('./pie'), - require('./contour'), - require('./scatterternary'), - require('./violin') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index-finance.js b/lib/index-finance.js deleted file mode 100644 index 58d20c76678..00000000000 --- a/lib/index-finance.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -var Plotly = require('./core'); - -Plotly.register([ - require('./bar'), - require('./histogram'), - require('./pie'), - require('./funnelarea'), - require('./ohlc'), - require('./candlestick'), - require('./funnel'), - require('./waterfall'), - require('./indicator') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index-geo.js b/lib/index-geo.js deleted file mode 100644 index 7317dccf4ea..00000000000 --- a/lib/index-geo.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var Plotly = require('./core'); - -Plotly.register([ - require('./scattergeo'), - require('./choropleth') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index-gl2d.js b/lib/index-gl2d.js deleted file mode 100644 index 10825b26f6e..00000000000 --- a/lib/index-gl2d.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var Plotly = require('./core'); - -Plotly.register([ - require('./scattergl'), - require('./splom'), - require('./pointcloud'), - require('./heatmapgl'), - require('./parcoords') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index-gl3d.js b/lib/index-gl3d.js deleted file mode 100644 index 24b471d5a1c..00000000000 --- a/lib/index-gl3d.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -var Plotly = require('./core'); - -Plotly.register([ - require('./scatter3d'), - require('./surface'), - require('./mesh3d'), - require('./isosurface'), - require('./volume'), - require('./cone'), - require('./streamtube') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index-mapbox.js b/lib/index-mapbox.js deleted file mode 100644 index ef5b04c28da..00000000000 --- a/lib/index-mapbox.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -var Plotly = require('./core'); - -Plotly.register([ - require('./scattermapbox'), - require('./choroplethmapbox'), - require('./densitymapbox') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index-strict.js b/lib/index-strict.js deleted file mode 100644 index 1b8d1d03f6f..00000000000 --- a/lib/index-strict.js +++ /dev/null @@ -1,55 +0,0 @@ -'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('./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') -]); - -module.exports = require('./register_extra')(Plotly); diff --git a/lib/index.js b/lib/index.js index 826c885afbc..d44923f6a3d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,67 +1,59 @@ 'use strict'; -var Plotly = require('./core'); +var Plotly = require('../src/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('./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('../src/traces/bar'), + require('../src/traces/box'), + require('../src/traces/heatmap'), + require('../src/traces/histogram'), + require('../src/traces/histogram2d'), + require('../src/traces/histogram2dcontour'), + require('../src/traces/contour'), + require('../src/traces/scatterternary'), + require('../src/traces/violin'), + require('../src/traces/funnel'), + require('../src/traces/waterfall'), + require('../src/traces/image'), + require('../src/traces/pie'), + require('../src/traces/sunburst'), + require('../src/traces/treemap'), + require('../src/traces/funnelarea'), + require('../src/traces/scatter3d'), + require('../src/traces/surface'), + require('../src/traces/isosurface'), + require('../src/traces/volume'), + require('../src/traces/mesh3d'), + require('../src/traces/cone'), + require('../src/traces/streamtube'), + require('../src/traces/scattergeo'), + require('../src/traces/choropleth'), + require('../src/traces/scattergl'), + require('../src/traces/splom'), + require('../src/traces/pointcloud'), + require('../src/traces/heatmapgl'), + require('../src/traces/parcoords'), + require('../src/traces/parcats'), + require('../src/traces/scattermapbox'), + require('../src/traces/choroplethmapbox'), + require('../src/traces/densitymapbox'), + require('../src/traces/sankey'), + require('../src/traces/indicator'), + require('../src/traces/table'), + require('../src/traces/carpet'), + require('../src/traces/scattercarpet'), + require('../src/traces/contourcarpet'), + require('../src/traces/ohlc'), + require('../src/traces/candlestick'), + require('../src/traces/scatterpolar'), + require('../src/traces/scatterpolargl'), + require('../src/traces/barpolar'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') ]); -module.exports = require('./register_extra')(Plotly); +module.exports = Plotly; diff --git a/lib/indicator.js b/lib/indicator.js deleted file mode 100644 index e9f5d384743..00000000000 --- a/lib/indicator.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/indicator'); diff --git a/lib/isosurface.js b/lib/isosurface.js deleted file mode 100644 index 569b4890eb1..00000000000 --- a/lib/isosurface.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/isosurface'); diff --git a/lib/mesh3d.js b/lib/mesh3d.js deleted file mode 100644 index 7b3ed28f705..00000000000 --- a/lib/mesh3d.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/mesh3d'); diff --git a/lib/ohlc.js b/lib/ohlc.js deleted file mode 100644 index 681e52fbc8a..00000000000 --- a/lib/ohlc.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/ohlc'); diff --git a/lib/parcats.js b/lib/parcats.js deleted file mode 100644 index d7110b45fe3..00000000000 --- a/lib/parcats.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/parcats'); diff --git a/lib/parcoords.js b/lib/parcoords.js deleted file mode 100644 index b86da9ddf10..00000000000 --- a/lib/parcoords.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/parcoords'); diff --git a/lib/pie.js b/lib/pie.js deleted file mode 100644 index c105e4c705b..00000000000 --- a/lib/pie.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/pie'); diff --git a/lib/pointcloud.js b/lib/pointcloud.js deleted file mode 100644 index 295cbe48ed6..00000000000 --- a/lib/pointcloud.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/pointcloud'); diff --git a/lib/register_extra.js b/lib/register_extra.js deleted file mode 100644 index ba1dedb939c..00000000000 --- a/lib/register_extra.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -module.exports = function registerExtra(Plotly) { - // transforms - // - // Please note that all *transform* methods are executed before - // all *calcTransform* methods - which could possibly lead to - // unexpected results when applying multiple transforms of different types - // to a given trace. - // - // For more info, see: - // https://github.com/plotly/plotly.js/pull/978#pullrequestreview-2403353 - // - Plotly.register([ - require('./aggregate'), - require('./filter'), - require('./groupby'), - require('./sort') - ]); - - // components - Plotly.register([ - require('./calendars') - ]); - - return Plotly; -}; diff --git a/lib/sankey.js b/lib/sankey.js deleted file mode 100644 index eac3e438989..00000000000 --- a/lib/sankey.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/sankey'); diff --git a/lib/scatter.js b/lib/scatter.js deleted file mode 100644 index e0d55443d08..00000000000 --- a/lib/scatter.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scatter'); diff --git a/lib/scatter3d.js b/lib/scatter3d.js deleted file mode 100644 index f922b7237f9..00000000000 --- a/lib/scatter3d.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scatter3d'); diff --git a/lib/scattercarpet.js b/lib/scattercarpet.js deleted file mode 100644 index 532ceba2c44..00000000000 --- a/lib/scattercarpet.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scattercarpet'); diff --git a/lib/scattergeo.js b/lib/scattergeo.js deleted file mode 100644 index 566c9e262ea..00000000000 --- a/lib/scattergeo.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scattergeo'); diff --git a/lib/scattergl.js b/lib/scattergl.js deleted file mode 100644 index c7e65b5c065..00000000000 --- a/lib/scattergl.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scattergl'); diff --git a/lib/scattermapbox.js b/lib/scattermapbox.js deleted file mode 100644 index acc67f81d92..00000000000 --- a/lib/scattermapbox.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scattermapbox'); diff --git a/lib/scatterpolar.js b/lib/scatterpolar.js deleted file mode 100644 index 744619551ed..00000000000 --- a/lib/scatterpolar.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scatterpolar'); diff --git a/lib/scatterpolargl.js b/lib/scatterpolargl.js deleted file mode 100644 index 380831b94c9..00000000000 --- a/lib/scatterpolargl.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scatterpolargl'); diff --git a/lib/scatterternary.js b/lib/scatterternary.js deleted file mode 100644 index 33bbd5f033f..00000000000 --- a/lib/scatterternary.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/scatterternary'); diff --git a/lib/sort.js b/lib/sort.js deleted file mode 100644 index 5180b3299ff..00000000000 --- a/lib/sort.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/transforms/sort'); diff --git a/lib/splom.js b/lib/splom.js deleted file mode 100644 index de34b05e8cb..00000000000 --- a/lib/splom.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/splom'); diff --git a/lib/streamtube.js b/lib/streamtube.js deleted file mode 100644 index ec155612b9d..00000000000 --- a/lib/streamtube.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/streamtube'); diff --git a/lib/sunburst.js b/lib/sunburst.js deleted file mode 100644 index 2406eaa39b5..00000000000 --- a/lib/sunburst.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/sunburst'); diff --git a/lib/surface.js b/lib/surface.js deleted file mode 100644 index 0f2e1f73163..00000000000 --- a/lib/surface.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/surface'); diff --git a/lib/table.js b/lib/table.js deleted file mode 100644 index 9b725b6c867..00000000000 --- a/lib/table.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/table'); diff --git a/lib/treemap.js b/lib/treemap.js deleted file mode 100644 index 5fde6c8828f..00000000000 --- a/lib/treemap.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/treemap'); diff --git a/lib/violin.js b/lib/violin.js deleted file mode 100644 index 37ca776d719..00000000000 --- a/lib/violin.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/violin'); diff --git a/lib/volume.js b/lib/volume.js deleted file mode 100644 index 00ddb1ec243..00000000000 --- a/lib/volume.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/volume'); diff --git a/lib/waterfall.js b/lib/waterfall.js deleted file mode 100644 index 529512264b3..00000000000 --- a/lib/waterfall.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../src/traces/waterfall'); diff --git a/package.json b/package.json index 43df47eb4f6..a79348fcfac 100644 --- a/package.json +++ b/package.json @@ -22,11 +22,11 @@ ], "scripts": { "bundle": "node tasks/bundle.js", - "header-dist": "node tasks/header_dist.js", + "partial-bundle": "node tasks/partial_bundle.js", "stats": "node tasks/stats.js", "find-strings": "node tasks/find_locale_strings.js", "preprocess": "node tasks/preprocess.js", - "build": "node tasks/empty_dist.js && npm run preprocess && npm run find-strings && npm run bundle && npm run header-dist && npm run stats", + "build": "node tasks/empty_dist.js && npm run preprocess && npm run find-strings && npm run bundle && npm run partial-bundle && npm run stats", "cibuild": "node tasks/empty_dist.js && npm run preprocess && node tasks/cibundle.js", "watch": "node tasks/watch.js", "lint": "eslint --version && eslint .", diff --git a/tasks/bundle.js b/tasks/bundle.js index 8e8a1c6474d..048c3bf42b7 100644 --- a/tasks/bundle.js +++ b/tasks/bundle.js @@ -1,26 +1,24 @@ var path = require('path'); var glob = require('glob'); var runSeries = require('run-series'); +var prependFile = require('prepend-file'); var constants = require('./util/constants'); var common = require('./util/common'); var _bundle = require('./util/browserify_wrapper'); var makeSchema = require('./util/make_schema'); var wrapLocale = require('./util/wrap_locale'); -/* - * This script takes one argument - * - * Run `npm run build -- dev` or `npm run build -- --dev` - * to include source map in the plotly.js bundle - * - * N.B. This script is meant for dist builds; the output bundles are placed - * in plotly.js/dist/. - * Use `npm run watch` for dev builds. - */ - -var arg = process.argv[2]; -var DEV = (arg === 'dev') || (arg === '--dev'); +var header = constants.licenseDist + '\n'; +var pathToLib = constants.pathToLib; +var pathToDist = constants.pathToDist; +var pathToSchema = constants.pathToSchema; +var pathToPlotlyDist = constants.pathToPlotlyDist; +var pathToPlotlyIndex = constants.pathToPlotlyIndex; +var pathToPlotlyDistMin = constants.pathToPlotlyDistMin; +var pathToPlotlyDistWithMeta = constants.pathToPlotlyDistWithMeta; +var pathToPlotlyGeoAssetsSrc = constants.pathToPlotlyGeoAssetsSrc; +var pathToPlotlyGeoAssetsDist = constants.pathToPlotlyGeoAssetsDist; // Check if style build file is there var doesFileExist = common.doesFileExist; @@ -32,11 +30,11 @@ if(!doesFileExist(constants.pathToCSSBuild)) { } // "Browserify" the locales -var localeGlob = path.join(constants.pathToLib, 'locales', '*.js'); +var localeGlob = path.join(pathToLib, 'locales', '*.js'); glob(localeGlob, function(err, files) { files.forEach(function(file) { var outName = 'plotly-locale-' + path.basename(file); - var outPath = path.join(constants.pathToDist, outName); + var outPath = path.join(pathToDist, outName); wrapLocale(file, outPath); }); }); @@ -46,41 +44,39 @@ glob(localeGlob, function(err, files) { var tasks = []; // Browserify plotly.js -tasks.push(function(cb) { - _bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDist, { +tasks.push(function(done) { + _bundle(pathToPlotlyIndex, pathToPlotlyDist, { standalone: 'Plotly', - debug: DEV, - pathToMinBundle: constants.pathToPlotlyDistMin - }, cb); + pathToMinBundle: pathToPlotlyDistMin + }, function() { + prependFile(pathToPlotlyDist, header, common.throwOnError); + prependFile(pathToPlotlyDistMin, header, common.throwOnError); + + done(); + }); }); // Browserify the geo assets -tasks.push(function(cb) { - _bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist, { +tasks.push(function(done) { + _bundle(pathToPlotlyGeoAssetsSrc, pathToPlotlyGeoAssetsDist, { standalone: 'PlotlyGeoAssets' - }, cb); + }, function() { + prependFile(pathToPlotlyGeoAssetsDist, header, common.throwOnError); + + done(); + }); }); // Browserify plotly.js with meta and output plot-schema JSON -tasks.push(function(cb) { - _bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, { +tasks.push(function(done) { + _bundle(pathToPlotlyIndex, pathToPlotlyDistWithMeta, { standalone: 'Plotly', - debug: DEV, noCompress: true }, function() { - makeSchema(constants.pathToPlotlyDistWithMeta, constants.pathToSchema)(); - cb(); - }); -}); + prependFile(pathToPlotlyDistWithMeta, header, common.throwOnError); -// Browserify the plotly.js partial bundles -constants.partialBundlePaths.forEach(function(pathObj) { - tasks.push(function(cb) { - _bundle(pathObj.index, pathObj.dist, { - standalone: 'Plotly', - debug: DEV, - pathToMinBundle: pathObj.distMin - }, cb); + makeSchema(pathToPlotlyDistWithMeta, pathToSchema)(); + done(); }); }); diff --git a/tasks/header_dist.js b/tasks/header_dist.js deleted file mode 100644 index 75d94ef221d..00000000000 --- a/tasks/header_dist.js +++ /dev/null @@ -1,33 +0,0 @@ -var prependFile = require('prepend-file'); -var constants = require('./util/constants'); -var common = require('./util/common'); - -function addHeadersInDistFiles() { - function _prepend(path, header) { - prependFile(path, header + '\n', common.throwOnError); - } - - // add header to main dist bundles - var pathsDist = [ - constants.pathToPlotlyDistMin, - constants.pathToPlotlyDist, - constants.pathToPlotlyDistWithMeta, - constants.pathToPlotlyGeoAssetsDist - ]; - pathsDist.forEach(function(path) { - _prepend(path, constants.licenseDist); - }); - - // add header and bundle name to partial bundle - constants.partialBundlePaths.forEach(function(pathObj) { - var headerDist = constants.licenseDist - .replace('plotly.js', 'plotly.js (' + pathObj.name + ')'); - _prepend(pathObj.dist, headerDist); - - var headerDistMin = constants.licenseDist - .replace('plotly.js', 'plotly.js (' + pathObj.name + ' - minified)'); - _prepend(pathObj.distMin, headerDistMin); - }); -} - -addHeadersInDistFiles(); diff --git a/tasks/partial_bundle.js b/tasks/partial_bundle.js new file mode 100644 index 00000000000..c69d71f2fbd --- /dev/null +++ b/tasks/partial_bundle.js @@ -0,0 +1,61 @@ +var fs = require('fs'); +var path = require('path'); +var runSeries = require('run-series'); +var prependFile = require('prepend-file'); + +var constants = require('./util/constants'); +var common = require('./util/common'); +var _bundle = require('./util/browserify_wrapper'); + +var header = constants.licenseDist + '\n'; + +var tasks = []; +var allTraces = fs.readdirSync(path.join(constants.pathToSrc, 'traces')); +var fullIndex = fs.readFileSync(constants.pathToPlotlyIndex, 'utf-8'); + +// Browserify the plotly.js partial bundles +constants.partialBundlePaths.forEach(function(pathObj) { + tasks.push(function(done) { + var traceList = constants.partialBundleTraces[pathObj.name]; + + var partialIndex = fullIndex; + allTraces.forEach(function(trace) { + if(traceList.indexOf(trace) === -1) { + var WHITESPACE_BEFORE = '\\s*'; + // remove require + var newCode = partialIndex.replace( + new RegExp( + WHITESPACE_BEFORE + + 'require\\(\'\\.\\./src/traces/' + trace + '\'\\),', + 'g'), '' + ); + + // test removal + if(newCode === partialIndex) throw 'Unable to find and drop require for trace: "' + trace + '"'; + + partialIndex = newCode; + } + }); + + common.writeFile(pathObj.index, partialIndex, done); + }); + + tasks.push(function(done) { + _bundle(pathObj.index, pathObj.dist, { + standalone: 'Plotly', + pathToMinBundle: pathObj.distMin + }, function() { + var headerDist = header.replace('plotly.js', 'plotly.js (' + pathObj.name + ')'); + var headerDistMin = header.replace('plotly.js', 'plotly.js (' + pathObj.name + ' - minified)'); + + prependFile(pathObj.dist, headerDist, common.throwOnError); + prependFile(pathObj.distMin, headerDistMin, common.throwOnError); + + done(); + }); + }); +}); + +runSeries(tasks, function(err) { + if(err) throw err; +}); diff --git a/tasks/stats.js b/tasks/stats.js index 3c61593196f..e9518bdc8a2 100644 --- a/tasks/stats.js +++ b/tasks/stats.js @@ -172,13 +172,13 @@ function makeBundleHeaderInfo(pathObj) { function makeBundleInfo(pathObj) { var name = pathObj.name; var sizes = findSizes(pathObj); - var moduleList = common.findModuleList(pathObj.index); + var traceList = constants.partialBundleTraces[pathObj.name]; var pkgName = 'plotly.js-' + name + '-dist'; return [ '### plotly.js ' + name, '', - 'The `' + name + '` partial bundle contains trace modules ' + common.formatEnumeration(moduleList) + '.', + 'The `' + name + '` partial bundle contains trace modules ' + common.formatEnumeration(traceList) + '.', '', '#### Stats', '', diff --git a/tasks/sync_packages.js b/tasks/sync_packages.js index 233ee797af9..4cd93e61839 100644 --- a/tasks/sync_packages.js +++ b/tasks/sync_packages.js @@ -103,14 +103,14 @@ function syncPartialBundlePkg(d) { function writeREADME(cb) { - var moduleList = common.findModuleList(d.index); + var traceList = constants.partialBundleTraces[d.name]; var cnt = [ '# ' + d.name, '', d.desc, '', - 'Contains trace modules ' + common.formatEnumeration(moduleList) + '.', + 'Contains trace modules ' + common.formatEnumeration(traceList) + '.', '', 'For more info on plotly.js, go to https://github.com/plotly/plotly.js', '', diff --git a/tasks/util/common.js b/tasks/util/common.js index 51a9a0528ca..e6b648ee86a 100644 --- a/tasks/util/common.js +++ b/tasks/util/common.js @@ -1,6 +1,5 @@ var fs = require('fs'); var exec = require('child_process').exec; -var falafel = require('falafel'); function _throw(err) { console.log(err); @@ -71,41 +70,6 @@ exports.throwOnError = function(err) { if(err) _throw(err); }; -exports.findModuleList = function(pathToIndex) { - var code = fs.readFileSync(pathToIndex, 'utf-8'); - // In v1.x, all partial bundles include the 'scatter' module - var moduleList = ['scatter']; - - falafel(code, function(node) { - if( - node.type === 'Literal' && - node.parent && - node.parent.type === 'CallExpression' && - node.parent.callee && - node.parent.callee.type === 'Identifier' && - node.parent.callee.name === 'require' && - node.parent.parent && - node.parent.parent.type === 'ArrayExpression' - ) { - var moduleName = node.value.replace('./', ''); - if([ - // transforms - 'aggregate', - 'filter', - 'groupby', - 'sort', - - // components - 'calendars' - ].indexOf(moduleName) === -1) { - moduleList.push(moduleName); - } - } - }); - - return moduleList; -}; - exports.formatEnumeration = function(list) { var len = list.length; diff --git a/tasks/util/constants.js b/tasks/util/constants.js index f1907fed400..e1d9c432f8d 100644 --- a/tasks/util/constants.js +++ b/tasks/util/constants.js @@ -29,10 +29,112 @@ var partialBundleNames = [ 'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox', 'finance', 'strict' ]; +var partialBundleTraces = { + basic: [ + 'bar', + 'pie', + 'scatter' + ], + cartesian: [ + 'bar', + 'box', + 'contour', + 'heatmap', + 'histogram', + 'histogram2d', + 'histogram2dcontour', + 'image', + 'pie', + 'scatter', + 'scatterternary', + 'violin' + ], + finance: [ + 'bar', + 'candlestick', + 'funnel', + 'funnelarea', + 'histogram', + 'indicator', + 'ohlc', + 'pie', + 'scatter', + 'waterfall' + ], + geo: [ + 'choropleth', + 'scatter', + 'scattergeo' + ], + gl2d: [ + 'heatmapgl', + 'parcoords', + 'pointcloud', + 'scatter', + 'scattergl', + 'splom' + ], + gl3d: [ + 'cone', + 'isosurface', + 'mesh3d', + 'scatter', + 'scatter3d', + 'streamtube', + 'surface', + 'volume' + ], + mapbox: [ + 'choroplethmapbox', + 'densitymapbox', + 'scatter', + 'scattermapbox' + ], + strict: [ + 'bar', + 'barpolar', + 'box', + 'candlestick', + 'carpet', + 'choropleth', + 'choroplethmapbox', + 'contour', + 'contourcarpet', + 'densitymapbox', + 'funnel', + 'funnelarea', + 'heatmap', + 'histogram', + 'histogram2d', + 'histogram2dcontour', + 'image', + 'indicator', + 'ohlc', + 'parcats', + 'parcoords', + 'pie', + 'sankey', + 'scatter', + 'scattercarpet', + 'scattergeo', + 'scattergl', + 'scattermapbox', + 'scatterpolar', + 'scatterpolargl', + 'scatterternary', + 'splom', + 'sunburst', + 'table', + 'treemap', + 'violin', + 'waterfall' + ] +}; + var partialBundlePaths = partialBundleNames.map(function(name) { return { name: name, - index: path.join(pathToLib, 'index-' + name + '.js'), + index: path.join(pathToBuild, 'index-' + name + '.js'), dist: path.join(pathToDist, 'plotly-' + name + '.js'), distMin: path.join(pathToDist, 'plotly-' + name + '.min.js') }; @@ -60,6 +162,7 @@ module.exports = { pathToSchema: path.join(pathToDist, 'plot-schema.json'), pathToTranslationKeys: path.join(pathToDist, 'translation-keys.txt'), + partialBundleTraces: partialBundleTraces, partialBundleNames: partialBundleNames, partialBundlePaths: partialBundlePaths, diff --git a/test/jasmine/assets/supply_defaults.js b/test/jasmine/assets/supply_defaults.js index 28bba9b870f..13f9d2bd0c0 100644 --- a/test/jasmine/assets/supply_defaults.js +++ b/test/jasmine/assets/supply_defaults.js @@ -4,7 +4,7 @@ var Plots = require('@src/plots/plots'); // The following is used to fill up the Registry module /* eslint-disable-next-line */ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); /** * supplyDefaults that fills in necessary _context diff --git a/test/jasmine/bundle_tests/bar_test.js b/test/jasmine/bundle_tests/bar_test.js index 03ab0f667d4..5803f1bfed8 100644 --- a/test/jasmine/bundle_tests/bar_test.js +++ b/test/jasmine/bundle_tests/bar_test.js @@ -1,7 +1,7 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib/core'); -var PlotlyBar = require('@lib/bar'); +var Plotly = require('@src/core'); +var PlotlyBar = require('@src/traces/bar'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/choropleth_test.js b/test/jasmine/bundle_tests/choropleth_test.js index 221b742c77b..dfd345c3987 100644 --- a/test/jasmine/bundle_tests/choropleth_test.js +++ b/test/jasmine/bundle_tests/choropleth_test.js @@ -1,7 +1,7 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib/core'); -var PlotlyChoropleth = require('@lib/choropleth'); +var Plotly = require('@src/core'); +var PlotlyChoropleth = require('@src/traces/choropleth'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/component_first_test.js b/test/jasmine/bundle_tests/component_first_test.js index 0b6bd24e9da..c57417f5fce 100644 --- a/test/jasmine/bundle_tests/component_first_test.js +++ b/test/jasmine/bundle_tests/component_first_test.js @@ -1,8 +1,8 @@ -var Plotly = require('@lib/core'); -var Bar = require('@lib/bar'); -var Scatter3d = require('@lib/scatter3d'); -var Filter = require('@lib/filter'); -var Calendars = require('@lib/calendars'); +var Plotly = require('@src/core'); +var Bar = require('@src/traces/bar'); +var Scatter3d = require('@src/traces/scatter3d'); +var Filter = require('@src/transforms/filter'); +var Calendars = require('@src/components/calendars'); var checkComponent = require('../assets/check_component'); diff --git a/test/jasmine/bundle_tests/component_last_test.js b/test/jasmine/bundle_tests/component_last_test.js index f0227ca102e..6da14e8b701 100644 --- a/test/jasmine/bundle_tests/component_last_test.js +++ b/test/jasmine/bundle_tests/component_last_test.js @@ -1,8 +1,8 @@ -var Plotly = require('@lib/core'); -var Bar = require('@lib/bar'); -var Scatter3d = require('@lib/scatter3d'); -var Filter = require('@lib/filter'); -var Calendars = require('@lib/calendars'); +var Plotly = require('@src/core'); +var Bar = require('@src/traces/bar'); +var Scatter3d = require('@src/traces/scatter3d'); +var Filter = require('@src/transforms/filter'); +var Calendars = require('@src/components/calendars'); var checkComponent = require('../assets/check_component'); diff --git a/test/jasmine/bundle_tests/contour_test.js b/test/jasmine/bundle_tests/contour_test.js index 96a225b5a59..96d8de0433f 100644 --- a/test/jasmine/bundle_tests/contour_test.js +++ b/test/jasmine/bundle_tests/contour_test.js @@ -1,7 +1,7 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib/core'); -var PlotlyContour = require('@lib/contour'); +var Plotly = require('@src/core'); +var PlotlyContour = require('@src/traces/contour'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/core_test.js b/test/jasmine/bundle_tests/core_test.js index 9140dbbe075..af09cdf1c22 100644 --- a/test/jasmine/bundle_tests/core_test.js +++ b/test/jasmine/bundle_tests/core_test.js @@ -1,6 +1,6 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib/core'); +var Plotly = require('@src/core'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/dynamic_import_test.js b/test/jasmine/bundle_tests/dynamic_import_test.js index 5dc42374ded..0ffb45e52c2 100644 --- a/test/jasmine/bundle_tests/dynamic_import_test.js +++ b/test/jasmine/bundle_tests/dynamic_import_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib/core'); +var Plotly = require('@src/core'); var d3Select = require('../../strict-d3').select; var createGraphDiv = require('../assets/create_graph_div'); @@ -20,7 +20,7 @@ describe('Dynamic @lib/ module imports', function() { // N.B. from a different subplot type // more info in: // https://github.com/plotly/plotly.js/issues/3428 - var ScatterPolar = require('@lib/scatterpolar'); + var ScatterPolar = require('@src/traces/scatterpolar'); Plotly.register(ScatterPolar); }) .then(function() { diff --git a/test/jasmine/bundle_tests/finance_test.js b/test/jasmine/bundle_tests/finance_test.js index 12a5926e10f..9f0143a07d4 100644 --- a/test/jasmine/bundle_tests/finance_test.js +++ b/test/jasmine/bundle_tests/finance_test.js @@ -1,7 +1,7 @@ var Plots = require('@src/plots/plots'); -var Plotly = require('@lib/core'); -var ohlc = require('@lib/ohlc'); -var candlestick = require('@lib/candlestick'); +var Plotly = require('@src/core'); +var ohlc = require('@src/traces/ohlc'); +var candlestick = require('@src/traces/candlestick'); var d3Select = require('../../strict-d3').select; var createGraphDiv = require('../assets/create_graph_div'); diff --git a/test/jasmine/bundle_tests/histogram2dcontour_test.js b/test/jasmine/bundle_tests/histogram2dcontour_test.js index d65868e050d..a263b5d26e2 100644 --- a/test/jasmine/bundle_tests/histogram2dcontour_test.js +++ b/test/jasmine/bundle_tests/histogram2dcontour_test.js @@ -1,8 +1,8 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib/core'); -var PlotlyHistogram2dContour = require('@lib/histogram2dcontour'); -var PlotlyHistogram = require('@lib/histogram'); +var Plotly = require('@src/core'); +var PlotlyHistogram2dContour = require('@src/traces/histogram2dcontour'); +var PlotlyHistogram = require('@src/traces/histogram'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/no_webgl_test.js b/test/jasmine/bundle_tests/no_webgl_test.js index 10a22e858c5..851b22b9d23 100644 --- a/test/jasmine/bundle_tests/no_webgl_test.js +++ b/test/jasmine/bundle_tests/no_webgl_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/tests/barpolar_test.js b/test/jasmine/tests/barpolar_test.js index 705955e453e..a5d93f9b0c8 100644 --- a/test/jasmine/tests/barpolar_test.js +++ b/test/jasmine/tests/barpolar_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); diff --git a/test/jasmine/tests/box_test.js b/test/jasmine/tests/box_test.js index d2234f56113..90ea550a3f8 100644 --- a/test/jasmine/tests/box_test.js +++ b/test/jasmine/tests/box_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var Plots = require('@src/plots/plots'); diff --git a/test/jasmine/tests/choropleth_test.js b/test/jasmine/tests/choropleth_test.js index 7e79160f6d4..c619b66158d 100644 --- a/test/jasmine/tests/choropleth_test.js +++ b/test/jasmine/tests/choropleth_test.js @@ -1,6 +1,6 @@ var Choropleth = require('@src/traces/choropleth'); -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); var loggers = require('@src/lib/loggers'); diff --git a/test/jasmine/tests/choroplethmapbox_test.js b/test/jasmine/tests/choroplethmapbox_test.js index b2eefb84eaf..5d380035190 100644 --- a/test/jasmine/tests/choroplethmapbox_test.js +++ b/test/jasmine/tests/choroplethmapbox_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); var loggers = require('@src/lib/loggers'); diff --git a/test/jasmine/tests/colorscale_test.js b/test/jasmine/tests/colorscale_test.js index 6b13bba80ec..f5f9eda7469 100644 --- a/test/jasmine/tests/colorscale_test.js +++ b/test/jasmine/tests/colorscale_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Colorscale = require('@src/components/colorscale'); diff --git a/test/jasmine/tests/cone_test.js b/test/jasmine/tests/cone_test.js index 780d39d0960..c38e857d150 100644 --- a/test/jasmine/tests/cone_test.js +++ b/test/jasmine/tests/cone_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); diff --git a/test/jasmine/tests/densitymapbox_test.js b/test/jasmine/tests/densitymapbox_test.js index 0d656adc61c..c77fd4a1923 100644 --- a/test/jasmine/tests/densitymapbox_test.js +++ b/test/jasmine/tests/densitymapbox_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); diff --git a/test/jasmine/tests/domain_ref_interact_test.js b/test/jasmine/tests/domain_ref_interact_test.js index 83ac2ba7992..46de30a01b1 100644 --- a/test/jasmine/tests/domain_ref_interact_test.js +++ b/test/jasmine/tests/domain_ref_interact_test.js @@ -3,10 +3,9 @@ var domainRefComponents = require('../assets/domain_ref_components'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var Plotly = require('../../../lib/index'); -var Lib = require('../../../src/lib'); -var getSVGElemScreenBBox = require( - '../assets/get_svg_elem_screen_bbox'); +var Plotly = require('@lib/index'); +var Lib = require('@src/lib'); +var getSVGElemScreenBBox = require('../assets/get_svg_elem_screen_bbox'); var testMock = require('../assets/domain_refs_editable.json'); var delay = require('../assets/delay'); var mouseEvent = require('../assets/mouse_event'); diff --git a/test/jasmine/tests/domain_ref_test.js b/test/jasmine/tests/domain_ref_test.js index 5d207c63938..86beb0ac92e 100644 --- a/test/jasmine/tests/domain_ref_test.js +++ b/test/jasmine/tests/domain_ref_test.js @@ -3,7 +3,7 @@ var domainRefComponents = require('../assets/domain_ref_components'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var Plotly = require('../../../lib/index'); +var Plotly = require('@lib/index'); // optionally specify a test number to run just a single test var testNumber; diff --git a/test/jasmine/tests/isosurface_test.js b/test/jasmine/tests/isosurface_test.js index 7ca3ab26638..afcb4066f11 100644 --- a/test/jasmine/tests/isosurface_test.js +++ b/test/jasmine/tests/isosurface_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); diff --git a/test/jasmine/tests/lib_test.js b/test/jasmine/tests/lib_test.js index 78af4c275b8..647c9c4d5b9 100644 --- a/test/jasmine/tests/lib_test.js +++ b/test/jasmine/tests/lib_test.js @@ -5,7 +5,7 @@ var config = require('@src/plot_api/plot_config').dfltConfig; var d3Select = require('../../strict-d3').select; var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/tests/localize_test.js b/test/jasmine/tests/localize_test.js index 1a02a12945f..00b10b51058 100644 --- a/test/jasmine/tests/localize_test.js +++ b/test/jasmine/tests/localize_test.js @@ -5,7 +5,7 @@ var Registry = require('@src/registry'); var d3Select = require('../../strict-d3').select; var utcFormat = require('d3-time-format').utcFormat; -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/tests/mapbox_test.js b/test/jasmine/tests/mapbox_test.js index 6d3f72982ae..769e127f72f 100644 --- a/test/jasmine/tests/mapbox_test.js +++ b/test/jasmine/tests/mapbox_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var Fx = require('@src/components/fx'); diff --git a/test/jasmine/tests/mesh3d_test.js b/test/jasmine/tests/mesh3d_test.js index 6ee95569b2b..ee52eb53dbf 100644 --- a/test/jasmine/tests/mesh3d_test.js +++ b/test/jasmine/tests/mesh3d_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var supplyDefaults = require('@src/traces/mesh3d').supplyDefaults; var createGraphDiv = require('../assets/create_graph_div'); diff --git a/test/jasmine/tests/page_test.js b/test/jasmine/tests/page_test.js index 0b505b04960..185fd0114fb 100644 --- a/test/jasmine/tests/page_test.js +++ b/test/jasmine/tests/page_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var d3Select = require('../../strict-d3').select; diff --git a/test/jasmine/tests/polar_test.js b/test/jasmine/tests/polar_test.js index bda000620a6..38418e6352e 100644 --- a/test/jasmine/tests/polar_test.js +++ b/test/jasmine/tests/polar_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var Polar = require('@src/plots/polar'); var constants = require('@src/plots/polar/constants'); diff --git a/test/jasmine/tests/range_selector_test.js b/test/jasmine/tests/range_selector_test.js index a921f5e2d7b..3a526b302ff 100644 --- a/test/jasmine/tests/range_selector_test.js +++ b/test/jasmine/tests/range_selector_test.js @@ -3,7 +3,7 @@ var getUpdateObject = require('@src/components/rangeselector/get_update_object') var d3Select = require('../../strict-d3').select; var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var Color = require('@src/components/color'); var createGraphDiv = require('../assets/create_graph_div'); diff --git a/test/jasmine/tests/scattergeo_test.js b/test/jasmine/tests/scattergeo_test.js index 389e4467b26..be408691350 100644 --- a/test/jasmine/tests/scattergeo_test.js +++ b/test/jasmine/tests/scattergeo_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var BADNUM = require('@src/constants/numerical').BADNUM; var loggers = require('@src/lib/loggers'); diff --git a/test/jasmine/tests/scattermapbox_test.js b/test/jasmine/tests/scattermapbox_test.js index 7bf7c4dcae6..6a8c5dbf661 100644 --- a/test/jasmine/tests/scattermapbox_test.js +++ b/test/jasmine/tests/scattermapbox_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); var Axes = require('@src/plots/cartesian/axes'); diff --git a/test/jasmine/tests/scatterpolar_test.js b/test/jasmine/tests/scatterpolar_test.js index fc8b5959759..a54f1548510 100644 --- a/test/jasmine/tests/scatterpolar_test.js +++ b/test/jasmine/tests/scatterpolar_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var ScatterPolar = require('@src/traces/scatterpolar'); diff --git a/test/jasmine/tests/scatterpolargl_test.js b/test/jasmine/tests/scatterpolargl_test.js index 14b603018f1..d591ea13740 100644 --- a/test/jasmine/tests/scatterpolargl_test.js +++ b/test/jasmine/tests/scatterpolargl_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var ScatterPolarGl = require('@src/traces/scatterpolargl'); diff --git a/test/jasmine/tests/scatterternary_test.js b/test/jasmine/tests/scatterternary_test.js index 495d1e33974..3d947a02b8b 100644 --- a/test/jasmine/tests/scatterternary_test.js +++ b/test/jasmine/tests/scatterternary_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var ScatterTernary = require('@src/traces/scatterternary'); diff --git a/test/jasmine/tests/sliders_test.js b/test/jasmine/tests/sliders_test.js index 3b7f9618fda..85021d3d51d 100644 --- a/test/jasmine/tests/sliders_test.js +++ b/test/jasmine/tests/sliders_test.js @@ -3,7 +3,7 @@ var constants = require('@src/components/sliders/constants'); var d3Select = require('../../strict-d3').select; var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/tests/splom_test.js b/test/jasmine/tests/splom_test.js index 7ec1f442c99..06af19794d3 100644 --- a/test/jasmine/tests/splom_test.js +++ b/test/jasmine/tests/splom_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var Plots = require('@src/plots/plots'); var Axes = require('@src/plots/cartesian/axes'); diff --git a/test/jasmine/tests/streamtube_test.js b/test/jasmine/tests/streamtube_test.js index 0209cd25cb4..deb9322b428 100644 --- a/test/jasmine/tests/streamtube_test.js +++ b/test/jasmine/tests/streamtube_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); diff --git a/test/jasmine/tests/sunburst_test.js b/test/jasmine/tests/sunburst_test.js index 72d8e26702b..28876802534 100644 --- a/test/jasmine/tests/sunburst_test.js +++ b/test/jasmine/tests/sunburst_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); var Drawing = require('@src/components/drawing'); diff --git a/test/jasmine/tests/ternary_test.js b/test/jasmine/tests/ternary_test.js index 5a648daeba6..27f6136994d 100644 --- a/test/jasmine/tests/ternary_test.js +++ b/test/jasmine/tests/ternary_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var rgb = require('@src/components/color').rgb; diff --git a/test/jasmine/tests/toimage_test.js b/test/jasmine/tests/toimage_test.js index 43aa1b724ec..cbaffb56efd 100644 --- a/test/jasmine/tests/toimage_test.js +++ b/test/jasmine/tests/toimage_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var d3Select = require('../../strict-d3').select; diff --git a/test/jasmine/tests/transform_filter_test.js b/test/jasmine/tests/transform_filter_test.js index ebf5d6fa082..3ba5195be95 100644 --- a/test/jasmine/tests/transform_filter_test.js +++ b/test/jasmine/tests/transform_filter_test.js @@ -1,5 +1,5 @@ var Plotly = require('@lib/index'); -var Filter = require('@lib/filter'); +var Filter = require('@src/transforms/filter'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); diff --git a/test/jasmine/tests/transform_multi_test.js b/test/jasmine/tests/transform_multi_test.js index 2dc8bc491ad..ecb8ec9e087 100644 --- a/test/jasmine/tests/transform_multi_test.js +++ b/test/jasmine/tests/transform_multi_test.js @@ -1,5 +1,5 @@ var Plotly = require('@lib/index'); -var Filter = require('@lib/filter'); +var Filter = require('@src/transforms/filter'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); diff --git a/test/jasmine/tests/treemap_test.js b/test/jasmine/tests/treemap_test.js index a435b3eb163..425a9fd528e 100644 --- a/test/jasmine/tests/treemap_test.js +++ b/test/jasmine/tests/treemap_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); var Drawing = require('@src/components/drawing'); diff --git a/test/jasmine/tests/updatemenus_test.js b/test/jasmine/tests/updatemenus_test.js index c2d02328df2..35eb0aa30a7 100644 --- a/test/jasmine/tests/updatemenus_test.js +++ b/test/jasmine/tests/updatemenus_test.js @@ -3,7 +3,7 @@ var constants = require('@src/components/updatemenus/constants'); var d3Select = require('../../strict-d3').select; var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var Events = require('@src/lib/events'); var Drawing = require('@src/components/drawing'); diff --git a/test/jasmine/tests/violin_test.js b/test/jasmine/tests/violin_test.js index a977f61d37a..54298aaba03 100644 --- a/test/jasmine/tests/violin_test.js +++ b/test/jasmine/tests/violin_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var Plots = require('@src/plots/plots'); diff --git a/test/jasmine/tests/volume_test.js b/test/jasmine/tests/volume_test.js index b44251c511d..9c55cddfad9 100644 --- a/test/jasmine/tests/volume_test.js +++ b/test/jasmine/tests/volume_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@lib'); +var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); From c3a8b48b499b9ffa8bdbc58a789fbb45c1237a1a Mon Sep 17 00:00:00 2001 From: archmoj Date: Tue, 16 Feb 2021 22:45:17 -0500 Subject: [PATCH 02/15] wrap Plotly to avoid unexpected character --- lib/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index d44923f6a3d..d3be17f675f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,8 +1,8 @@ 'use strict'; -var Plotly = require('../src/core'); +var core = require('../src/core'); -Plotly.register([ +core.register([ require('../src/traces/bar'), require('../src/traces/box'), require('../src/traces/heatmap'), @@ -56,4 +56,4 @@ Plotly.register([ require('../src/components/calendars') ]); -module.exports = Plotly; +module.exports = (function(Plotly) { return Plotly; })(core); From 4f862ca9c08a7fe32fd37177f47b5f37a6852836 Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 17 Feb 2021 13:07:27 -0500 Subject: [PATCH 03/15] add extra_bundles - handle options in partial_bundle --- package.json | 5 +-- tasks/extra_bundles.js | 24 ++++++++++++++ tasks/no_es6_dist.js | 4 ++- tasks/partial_bundle.js | 73 ++++++++++++++++++++++++++++++++--------- tasks/stats.js | 8 +++-- tasks/sync_packages.js | 8 +++-- tasks/util/constants.js | 9 ++--- 7 files changed, 102 insertions(+), 29 deletions(-) create mode 100644 tasks/extra_bundles.js diff --git a/package.json b/package.json index a79348fcfac..e7751315567 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,13 @@ "plotly" ], "scripts": { - "bundle": "node tasks/bundle.js", "partial-bundle": "node tasks/partial_bundle.js", + "bundle": "node tasks/bundle.js", + "extra-bundles": "node tasks/extra_bundles.js", "stats": "node tasks/stats.js", "find-strings": "node tasks/find_locale_strings.js", "preprocess": "node tasks/preprocess.js", - "build": "node tasks/empty_dist.js && npm run preprocess && npm run find-strings && npm run bundle && npm run partial-bundle && npm run stats", + "build": "node tasks/empty_dist.js && npm run preprocess && npm run find-strings && npm run bundle && npm run extra-bundles && npm run stats", "cibuild": "node tasks/empty_dist.js && npm run preprocess && node tasks/cibundle.js", "watch": "node tasks/watch.js", "lint": "eslint --version && eslint .", diff --git a/tasks/extra_bundles.js b/tasks/extra_bundles.js new file mode 100644 index 00000000000..958d185a62c --- /dev/null +++ b/tasks/extra_bundles.js @@ -0,0 +1,24 @@ +var runSeries = require('run-series'); + +var partialBundle = require('./partial_bundle'); +var constants = require('./util/constants'); +var partialBundlePaths = constants.partialBundleNames.map(constants.makePartialBundleOpts); + +var tasks = []; + +// Browserify the plotly.js partial bundles +for(var i = 0; i < partialBundlePaths.length; i++) { + var opts = partialBundlePaths[i]; + + partialBundle(tasks, { + name: opts.name, + index: opts.index, + dist: opts.dist, + distMin: opts.distMin, + traceList: opts.traceList + }); +} + +runSeries(tasks, function(err) { + if(err) throw err; +}); diff --git a/tasks/no_es6_dist.js b/tasks/no_es6_dist.js index 955dfe975bf..fbb2d6cae93 100644 --- a/tasks/no_es6_dist.js +++ b/tasks/no_es6_dist.js @@ -2,6 +2,8 @@ var eslint = require('eslint'); var constants = require('./util/constants'); var EXIT_CODE = 0; +var partialBundlePaths = constants.partialBundleNames.map(constants.makePartialBundleOpts); + assertES5(); // Ensure no ES6 has snuck through into the build: @@ -17,7 +19,7 @@ function assertES5() { } }); - var files = constants.partialBundlePaths.map(function(f) { return f.dist; }); + var files = partialBundlePaths.map(function(f) { return f.dist; }); files.unshift(constants.pathToPlotlyDist); var report = cli.executeOnFiles(files); diff --git a/tasks/partial_bundle.js b/tasks/partial_bundle.js index c69d71f2fbd..74ed8b61c83 100644 --- a/tasks/partial_bundle.js +++ b/tasks/partial_bundle.js @@ -8,16 +8,59 @@ var common = require('./util/common'); var _bundle = require('./util/browserify_wrapper'); var header = constants.licenseDist + '\n'; - -var tasks = []; var allTraces = fs.readdirSync(path.join(constants.pathToSrc, 'traces')); var fullIndex = fs.readFileSync(constants.pathToPlotlyIndex, 'utf-8'); +var argv = process.argv; + +if(argv.length > 2) { + // command line + + var traceList = ['scatter']; // added by default + var name; + for(var i = 2; i < argv.length; i++) { + var a = argv[i]; + + if( + allTraces.indexOf(a) !== -1 && // requested + traceList.indexOf(a) === -1 // not added before + ) { + traceList.push(a); + } + if(a.indexOf('name=') !== -1) name = a.replace('name=', ''); + } + if(!name) name = 'custom'; + traceList = traceList.sort(); + + var opts = { + traceList: traceList, + name: name, + + index: path.join(constants.pathToBuild, 'index-' + name + '.js'), + dist: path.join(constants.pathToDist, 'plotly-' + name + '.js'), + distMin: path.join(constants.pathToDist, 'plotly-' + name + '.min.js') + }; + + console.log(opts); + + var tasks = []; + + partialBundle(tasks, opts); + + runSeries(tasks, function(err) { + if(err) throw err; + }); +} + // Browserify the plotly.js partial bundles -constants.partialBundlePaths.forEach(function(pathObj) { - tasks.push(function(done) { - var traceList = constants.partialBundleTraces[pathObj.name]; +function partialBundle(tasks, opts) { + var name = opts.name; + var index = opts.index; + var dist = opts.dist; + var distMin = opts.distMin; + var traceList = opts.traceList; + tasks.push(function(done) { var partialIndex = fullIndex; allTraces.forEach(function(trace) { if(traceList.indexOf(trace) === -1) { @@ -37,25 +80,23 @@ constants.partialBundlePaths.forEach(function(pathObj) { } }); - common.writeFile(pathObj.index, partialIndex, done); + common.writeFile(index, partialIndex, done); }); tasks.push(function(done) { - _bundle(pathObj.index, pathObj.dist, { + _bundle(index, dist, { standalone: 'Plotly', - pathToMinBundle: pathObj.distMin + pathToMinBundle: distMin }, function() { - var headerDist = header.replace('plotly.js', 'plotly.js (' + pathObj.name + ')'); - var headerDistMin = header.replace('plotly.js', 'plotly.js (' + pathObj.name + ' - minified)'); + var headerDist = header.replace('plotly.js', 'plotly.js (' + name + ')'); + var headerDistMin = header.replace('plotly.js', 'plotly.js (' + name + ' - minified)'); - prependFile(pathObj.dist, headerDist, common.throwOnError); - prependFile(pathObj.distMin, headerDistMin, common.throwOnError); + prependFile(dist, headerDist, common.throwOnError); + prependFile(distMin, headerDistMin, common.throwOnError); done(); }); }); -}); +} -runSeries(tasks, function(err) { - if(err) throw err; -}); +module.exports = partialBundle; diff --git a/tasks/stats.js b/tasks/stats.js index e9518bdc8a2..e971a66f340 100644 --- a/tasks/stats.js +++ b/tasks/stats.js @@ -19,6 +19,8 @@ var ENC = 'utf-8'; var JS = '.js'; var MINJS = '.min.js'; +var partialBundlePaths = constants.partialBundleNames.map(constants.makePartialBundleOpts); + // main common.writeFile(pathDistREADME, getReadMeContent()); @@ -136,7 +138,7 @@ function getMainBundleInfo() { '', 'Starting in `v1.15.0`, plotly.js also ships with several _partial_ bundles:', '', - constants.partialBundlePaths.map(makeBundleHeaderInfo).join('\n'), + partialBundlePaths.map(makeBundleHeaderInfo).join('\n'), '', 'Starting in `v1.39.0`, each plotly.js partial bundle has a corresponding npm package with no dependencies.', '', @@ -151,7 +153,7 @@ function getMainBundleInfo() { // info about partial bundles function getPartialBundleInfo() { - return constants.partialBundlePaths.map(makeBundleInfo); + return partialBundlePaths.map(makeBundleInfo); } // footer info @@ -172,7 +174,7 @@ function makeBundleHeaderInfo(pathObj) { function makeBundleInfo(pathObj) { var name = pathObj.name; var sizes = findSizes(pathObj); - var traceList = constants.partialBundleTraces[pathObj.name]; + var traceList = pathObj.traceList; var pkgName = 'plotly.js-' + name + '-dist'; return [ diff --git a/tasks/sync_packages.js b/tasks/sync_packages.js index 4cd93e61839..791a1e6afd0 100644 --- a/tasks/sync_packages.js +++ b/tasks/sync_packages.js @@ -23,8 +23,10 @@ var copyrightAndLicense = [ '' ].join('\n'); +var partialBundlePaths = constants.partialBundleNames.map(constants.makePartialBundleOpts); + // sync "partial bundle" packages -constants.partialBundlePaths +partialBundlePaths .map(function(d) { return { name: 'plotly.js-' + d.name + '-dist', @@ -44,7 +46,7 @@ constants.partialBundlePaths .forEach(syncPartialBundlePkg); // sync "minified partial bundle" packages -constants.partialBundlePaths +partialBundlePaths .map(function(d) { return { name: 'plotly.js-' + d.name + '-dist-min', @@ -103,7 +105,7 @@ function syncPartialBundlePkg(d) { function writeREADME(cb) { - var traceList = constants.partialBundleTraces[d.name]; + var traceList = d.traceList; var cnt = [ '# ' + d.name, diff --git a/tasks/util/constants.js b/tasks/util/constants.js index e1d9c432f8d..e727843480a 100644 --- a/tasks/util/constants.js +++ b/tasks/util/constants.js @@ -131,18 +131,21 @@ var partialBundleTraces = { ] }; -var partialBundlePaths = partialBundleNames.map(function(name) { +function makePartialBundleOpts(name) { return { name: name, + traceList: partialBundleTraces[name], index: path.join(pathToBuild, 'index-' + name + '.js'), dist: path.join(pathToDist, 'plotly-' + name + '.js'), distMin: path.join(pathToDist, 'plotly-' + name + '.min.js') }; -}); +} var year = (new Date()).getFullYear(); module.exports = { + makePartialBundleOpts: makePartialBundleOpts, + pathToRoot: pathToRoot, pathToSrc: pathToSrc, pathToLib: pathToLib, @@ -162,9 +165,7 @@ module.exports = { pathToSchema: path.join(pathToDist, 'plot-schema.json'), pathToTranslationKeys: path.join(pathToDist, 'translation-keys.txt'), - partialBundleTraces: partialBundleTraces, partialBundleNames: partialBundleNames, - partialBundlePaths: partialBundlePaths, pathToTopojsonSrc: pathToTopojsonSrc, pathToTopojsonDist: path.join(pathToDist, 'topojson/'), From e4c2f867ff9ce60a1c89af35c1dad514931d9052 Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 17 Feb 2021 15:33:06 -0500 Subject: [PATCH 04/15] update README on how to use the script to make custom bundles --- README.md | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index af2fbfdb577..c5aea35c50b 100644 --- a/README.md +++ b/README.md @@ -75,26 +75,9 @@ Starting in `v1.15.0`, plotly.js ships with several _partial_ bundles (more info Starting in `v1.39.0`, plotly.js publishes _distributed_ npm packages with no dependencies. For example, run `npm install plotly.js-geo-dist` and add `import Plotly from 'plotly.js-geo-dist';` to your code to start using the plotly.js geo package. -If none of the distributed npm packages meet your needs, and you would like to manually pick which plotly.js modules to include, you'll first need to run `npm install plotly.js` and then create a *custom* bundle by using `plotly.js/lib/core`, and loading only the trace types that you need (e.g. `pie` or `choropleth`). The recommended way to do this is by creating a *bundling file*. For example, in CommonJS: +If none of the distributed npm packages meet your needs, you create custom bundle of desired trace modules e.g. `pie` and `sunburst` using +`npm run partial-bundle pie sunburst name=custom` -```javascript -// in custom-plotly.js -var Plotly = require('plotly.js/lib/core'); - -// Load in the trace types for pie, and choropleth -Plotly.register([ - require('plotly.js/lib/pie'), - require('plotly.js/lib/choropleth') -]); - -module.exports = Plotly; -``` - -Then elsewhere in your code: - -```javascript -var Plotly = require('./path/to/custom-plotly'); -``` #### Non-ascii characters From 836248c03f7ad338ddd767a07e97001781d6cd54 Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 17 Feb 2021 15:36:23 -0500 Subject: [PATCH 05/15] remove note concerning non-ascii characters from README --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index c5aea35c50b..196a06f4885 100644 --- a/README.md +++ b/README.md @@ -79,14 +79,6 @@ If none of the distributed npm packages meet your needs, you create custom bundl `npm run partial-bundle pie sunburst name=custom` -#### Non-ascii characters - -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 - -``` - ## Building plotly.js Building instructions using `webpack`, `browserify` and other build frameworks are in [`BUILDING.md`](https://github.com/plotly/plotly.js/blob/master/BUILDING.md) From 01136b75cfd01cf4f10ca9e88d0c8d981c3adbc4 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 09:24:38 -0500 Subject: [PATCH 06/15] write component files to lib - generated component files using preprocess in lib - deprecate component files in lib --- lib/aggregate.js | 3 +++ lib/bar.js | 3 +++ lib/barpolar.js | 3 +++ lib/box.js | 3 +++ lib/calendars.js | 3 +++ lib/candlestick.js | 3 +++ lib/carpet.js | 3 +++ lib/choropleth.js | 3 +++ lib/choroplethmapbox.js | 3 +++ lib/cone.js | 3 +++ lib/contour.js | 3 +++ lib/contourcarpet.js | 3 +++ lib/densitymapbox.js | 3 +++ lib/filter.js | 3 +++ lib/funnel.js | 3 +++ lib/funnelarea.js | 3 +++ lib/groupby.js | 3 +++ lib/heatmap.js | 3 +++ lib/heatmapgl.js | 3 +++ lib/histogram.js | 3 +++ lib/histogram2d.js | 3 +++ lib/histogram2dcontour.js | 3 +++ lib/image.js | 3 +++ lib/indicator.js | 3 +++ lib/isosurface.js | 3 +++ lib/mesh3d.js | 3 +++ lib/ohlc.js | 3 +++ lib/parcats.js | 3 +++ lib/parcoords.js | 3 +++ lib/pie.js | 3 +++ lib/pointcloud.js | 3 +++ lib/sankey.js | 3 +++ lib/scatter.js | 3 +++ lib/scatter3d.js | 3 +++ lib/scattercarpet.js | 3 +++ lib/scattergeo.js | 3 +++ lib/scattergl.js | 3 +++ lib/scattermapbox.js | 3 +++ lib/scatterpolar.js | 3 +++ lib/scatterpolargl.js | 3 +++ lib/scatterternary.js | 3 +++ lib/sort.js | 3 +++ lib/splom.js | 3 +++ lib/streamtube.js | 3 +++ lib/sunburst.js | 3 +++ lib/surface.js | 3 +++ lib/table.js | 3 +++ lib/treemap.js | 3 +++ lib/violin.js | 3 +++ lib/volume.js | 3 +++ lib/waterfall.js | 3 +++ tasks/partial_bundle.js | 7 +++---- tasks/preprocess.js | 41 +++++++++++++++++++++++++++++++++++++++ tasks/util/constants.js | 11 ++++++++++- 54 files changed, 207 insertions(+), 5 deletions(-) create mode 100644 lib/aggregate.js create mode 100644 lib/bar.js create mode 100644 lib/barpolar.js create mode 100644 lib/box.js create mode 100644 lib/calendars.js create mode 100644 lib/candlestick.js create mode 100644 lib/carpet.js create mode 100644 lib/choropleth.js create mode 100644 lib/choroplethmapbox.js create mode 100644 lib/cone.js create mode 100644 lib/contour.js create mode 100644 lib/contourcarpet.js create mode 100644 lib/densitymapbox.js create mode 100644 lib/filter.js create mode 100644 lib/funnel.js create mode 100644 lib/funnelarea.js create mode 100644 lib/groupby.js create mode 100644 lib/heatmap.js create mode 100644 lib/heatmapgl.js create mode 100644 lib/histogram.js create mode 100644 lib/histogram2d.js create mode 100644 lib/histogram2dcontour.js create mode 100644 lib/image.js create mode 100644 lib/indicator.js create mode 100644 lib/isosurface.js create mode 100644 lib/mesh3d.js create mode 100644 lib/ohlc.js create mode 100644 lib/parcats.js create mode 100644 lib/parcoords.js create mode 100644 lib/pie.js create mode 100644 lib/pointcloud.js create mode 100644 lib/sankey.js create mode 100644 lib/scatter.js create mode 100644 lib/scatter3d.js create mode 100644 lib/scattercarpet.js create mode 100644 lib/scattergeo.js create mode 100644 lib/scattergl.js create mode 100644 lib/scattermapbox.js create mode 100644 lib/scatterpolar.js create mode 100644 lib/scatterpolargl.js create mode 100644 lib/scatterternary.js create mode 100644 lib/sort.js create mode 100644 lib/splom.js create mode 100644 lib/streamtube.js create mode 100644 lib/sunburst.js create mode 100644 lib/surface.js create mode 100644 lib/table.js create mode 100644 lib/treemap.js create mode 100644 lib/violin.js create mode 100644 lib/volume.js create mode 100644 lib/waterfall.js diff --git a/lib/aggregate.js b/lib/aggregate.js new file mode 100644 index 00000000000..7ae520418d5 --- /dev/null +++ b/lib/aggregate.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/transforms/aggregate instead of lib/aggregate +module.exports = require('../src/transforms/aggregate'); diff --git a/lib/bar.js b/lib/bar.js new file mode 100644 index 00000000000..94275adcf59 --- /dev/null +++ b/lib/bar.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/bar instead of lib/bar +module.exports = require('../src/traces/bar'); diff --git a/lib/barpolar.js b/lib/barpolar.js new file mode 100644 index 00000000000..82c01f50d8c --- /dev/null +++ b/lib/barpolar.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/barpolar instead of lib/barpolar +module.exports = require('../src/traces/barpolar'); diff --git a/lib/box.js b/lib/box.js new file mode 100644 index 00000000000..146586eb7c4 --- /dev/null +++ b/lib/box.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/box instead of lib/box +module.exports = require('../src/traces/box'); diff --git a/lib/calendars.js b/lib/calendars.js new file mode 100644 index 00000000000..518b8b882fe --- /dev/null +++ b/lib/calendars.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/components/calendars instead of lib/calendars +module.exports = require('../src/components/calendars'); diff --git a/lib/candlestick.js b/lib/candlestick.js new file mode 100644 index 00000000000..1fed8093379 --- /dev/null +++ b/lib/candlestick.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/candlestick instead of lib/candlestick +module.exports = require('../src/traces/candlestick'); diff --git a/lib/carpet.js b/lib/carpet.js new file mode 100644 index 00000000000..49d17579229 --- /dev/null +++ b/lib/carpet.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/carpet instead of lib/carpet +module.exports = require('../src/traces/carpet'); diff --git a/lib/choropleth.js b/lib/choropleth.js new file mode 100644 index 00000000000..7d891ec5417 --- /dev/null +++ b/lib/choropleth.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/choropleth instead of lib/choropleth +module.exports = require('../src/traces/choropleth'); diff --git a/lib/choroplethmapbox.js b/lib/choroplethmapbox.js new file mode 100644 index 00000000000..b9e6959a0f6 --- /dev/null +++ b/lib/choroplethmapbox.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/choroplethmapbox instead of lib/choroplethmapbox +module.exports = require('../src/traces/choroplethmapbox'); diff --git a/lib/cone.js b/lib/cone.js new file mode 100644 index 00000000000..c1b1acd97b6 --- /dev/null +++ b/lib/cone.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/cone instead of lib/cone +module.exports = require('../src/traces/cone'); diff --git a/lib/contour.js b/lib/contour.js new file mode 100644 index 00000000000..8a83bc77c9a --- /dev/null +++ b/lib/contour.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/contour instead of lib/contour +module.exports = require('../src/traces/contour'); diff --git a/lib/contourcarpet.js b/lib/contourcarpet.js new file mode 100644 index 00000000000..3e0d2c56b1d --- /dev/null +++ b/lib/contourcarpet.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/contourcarpet instead of lib/contourcarpet +module.exports = require('../src/traces/contourcarpet'); diff --git a/lib/densitymapbox.js b/lib/densitymapbox.js new file mode 100644 index 00000000000..fd968bb20b2 --- /dev/null +++ b/lib/densitymapbox.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/densitymapbox instead of lib/densitymapbox +module.exports = require('../src/traces/densitymapbox'); diff --git a/lib/filter.js b/lib/filter.js new file mode 100644 index 00000000000..34642aa3587 --- /dev/null +++ b/lib/filter.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/transforms/filter instead of lib/filter +module.exports = require('../src/transforms/filter'); diff --git a/lib/funnel.js b/lib/funnel.js new file mode 100644 index 00000000000..02d1c47f085 --- /dev/null +++ b/lib/funnel.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/funnel instead of lib/funnel +module.exports = require('../src/traces/funnel'); diff --git a/lib/funnelarea.js b/lib/funnelarea.js new file mode 100644 index 00000000000..a743a91b07e --- /dev/null +++ b/lib/funnelarea.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/funnelarea instead of lib/funnelarea +module.exports = require('../src/traces/funnelarea'); diff --git a/lib/groupby.js b/lib/groupby.js new file mode 100644 index 00000000000..68567abe998 --- /dev/null +++ b/lib/groupby.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/transforms/groupby instead of lib/groupby +module.exports = require('../src/transforms/groupby'); diff --git a/lib/heatmap.js b/lib/heatmap.js new file mode 100644 index 00000000000..399da36c170 --- /dev/null +++ b/lib/heatmap.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/heatmap instead of lib/heatmap +module.exports = require('../src/traces/heatmap'); diff --git a/lib/heatmapgl.js b/lib/heatmapgl.js new file mode 100644 index 00000000000..c09badbfe55 --- /dev/null +++ b/lib/heatmapgl.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/heatmapgl instead of lib/heatmapgl +module.exports = require('../src/traces/heatmapgl'); diff --git a/lib/histogram.js b/lib/histogram.js new file mode 100644 index 00000000000..3aef42ab584 --- /dev/null +++ b/lib/histogram.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/histogram instead of lib/histogram +module.exports = require('../src/traces/histogram'); diff --git a/lib/histogram2d.js b/lib/histogram2d.js new file mode 100644 index 00000000000..f1384195381 --- /dev/null +++ b/lib/histogram2d.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/histogram2d instead of lib/histogram2d +module.exports = require('../src/traces/histogram2d'); diff --git a/lib/histogram2dcontour.js b/lib/histogram2dcontour.js new file mode 100644 index 00000000000..8fa88e8bcc0 --- /dev/null +++ b/lib/histogram2dcontour.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/histogram2dcontour instead of lib/histogram2dcontour +module.exports = require('../src/traces/histogram2dcontour'); diff --git a/lib/image.js b/lib/image.js new file mode 100644 index 00000000000..3078d067879 --- /dev/null +++ b/lib/image.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/image instead of lib/image +module.exports = require('../src/traces/image'); diff --git a/lib/indicator.js b/lib/indicator.js new file mode 100644 index 00000000000..c1d2f360737 --- /dev/null +++ b/lib/indicator.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/indicator instead of lib/indicator +module.exports = require('../src/traces/indicator'); diff --git a/lib/isosurface.js b/lib/isosurface.js new file mode 100644 index 00000000000..eefe6b99430 --- /dev/null +++ b/lib/isosurface.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/isosurface instead of lib/isosurface +module.exports = require('../src/traces/isosurface'); diff --git a/lib/mesh3d.js b/lib/mesh3d.js new file mode 100644 index 00000000000..7185e0ef2fe --- /dev/null +++ b/lib/mesh3d.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/mesh3d instead of lib/mesh3d +module.exports = require('../src/traces/mesh3d'); diff --git a/lib/ohlc.js b/lib/ohlc.js new file mode 100644 index 00000000000..895e0ab4fbd --- /dev/null +++ b/lib/ohlc.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/ohlc instead of lib/ohlc +module.exports = require('../src/traces/ohlc'); diff --git a/lib/parcats.js b/lib/parcats.js new file mode 100644 index 00000000000..669a6ec1a31 --- /dev/null +++ b/lib/parcats.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/parcats instead of lib/parcats +module.exports = require('../src/traces/parcats'); diff --git a/lib/parcoords.js b/lib/parcoords.js new file mode 100644 index 00000000000..e8f5888c4b5 --- /dev/null +++ b/lib/parcoords.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/parcoords instead of lib/parcoords +module.exports = require('../src/traces/parcoords'); diff --git a/lib/pie.js b/lib/pie.js new file mode 100644 index 00000000000..7cf4a0b1950 --- /dev/null +++ b/lib/pie.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/pie instead of lib/pie +module.exports = require('../src/traces/pie'); diff --git a/lib/pointcloud.js b/lib/pointcloud.js new file mode 100644 index 00000000000..9d46632882b --- /dev/null +++ b/lib/pointcloud.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/pointcloud instead of lib/pointcloud +module.exports = require('../src/traces/pointcloud'); diff --git a/lib/sankey.js b/lib/sankey.js new file mode 100644 index 00000000000..f791fdbf2dd --- /dev/null +++ b/lib/sankey.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/sankey instead of lib/sankey +module.exports = require('../src/traces/sankey'); diff --git a/lib/scatter.js b/lib/scatter.js new file mode 100644 index 00000000000..5c8851b74ef --- /dev/null +++ b/lib/scatter.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scatter instead of lib/scatter +module.exports = require('../src/traces/scatter'); diff --git a/lib/scatter3d.js b/lib/scatter3d.js new file mode 100644 index 00000000000..10d06cd2ba4 --- /dev/null +++ b/lib/scatter3d.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scatter3d instead of lib/scatter3d +module.exports = require('../src/traces/scatter3d'); diff --git a/lib/scattercarpet.js b/lib/scattercarpet.js new file mode 100644 index 00000000000..8d1f2eadc99 --- /dev/null +++ b/lib/scattercarpet.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scattercarpet instead of lib/scattercarpet +module.exports = require('../src/traces/scattercarpet'); diff --git a/lib/scattergeo.js b/lib/scattergeo.js new file mode 100644 index 00000000000..63e8becd688 --- /dev/null +++ b/lib/scattergeo.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scattergeo instead of lib/scattergeo +module.exports = require('../src/traces/scattergeo'); diff --git a/lib/scattergl.js b/lib/scattergl.js new file mode 100644 index 00000000000..9e7bbe3d96f --- /dev/null +++ b/lib/scattergl.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scattergl instead of lib/scattergl +module.exports = require('../src/traces/scattergl'); diff --git a/lib/scattermapbox.js b/lib/scattermapbox.js new file mode 100644 index 00000000000..d8550b65510 --- /dev/null +++ b/lib/scattermapbox.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scattermapbox instead of lib/scattermapbox +module.exports = require('../src/traces/scattermapbox'); diff --git a/lib/scatterpolar.js b/lib/scatterpolar.js new file mode 100644 index 00000000000..f29bac62d82 --- /dev/null +++ b/lib/scatterpolar.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scatterpolar instead of lib/scatterpolar +module.exports = require('../src/traces/scatterpolar'); diff --git a/lib/scatterpolargl.js b/lib/scatterpolargl.js new file mode 100644 index 00000000000..281f83ab57e --- /dev/null +++ b/lib/scatterpolargl.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scatterpolargl instead of lib/scatterpolargl +module.exports = require('../src/traces/scatterpolargl'); diff --git a/lib/scatterternary.js b/lib/scatterternary.js new file mode 100644 index 00000000000..120f29aa64a --- /dev/null +++ b/lib/scatterternary.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/scatterternary instead of lib/scatterternary +module.exports = require('../src/traces/scatterternary'); diff --git a/lib/sort.js b/lib/sort.js new file mode 100644 index 00000000000..07c127115ee --- /dev/null +++ b/lib/sort.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/transforms/sort instead of lib/sort +module.exports = require('../src/transforms/sort'); diff --git a/lib/splom.js b/lib/splom.js new file mode 100644 index 00000000000..8b93100865e --- /dev/null +++ b/lib/splom.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/splom instead of lib/splom +module.exports = require('../src/traces/splom'); diff --git a/lib/streamtube.js b/lib/streamtube.js new file mode 100644 index 00000000000..6dc26e72dd2 --- /dev/null +++ b/lib/streamtube.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/streamtube instead of lib/streamtube +module.exports = require('../src/traces/streamtube'); diff --git a/lib/sunburst.js b/lib/sunburst.js new file mode 100644 index 00000000000..4470ebf6ae9 --- /dev/null +++ b/lib/sunburst.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/sunburst instead of lib/sunburst +module.exports = require('../src/traces/sunburst'); diff --git a/lib/surface.js b/lib/surface.js new file mode 100644 index 00000000000..84de66504d5 --- /dev/null +++ b/lib/surface.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/surface instead of lib/surface +module.exports = require('../src/traces/surface'); diff --git a/lib/table.js b/lib/table.js new file mode 100644 index 00000000000..4d671d85ec5 --- /dev/null +++ b/lib/table.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/table instead of lib/table +module.exports = require('../src/traces/table'); diff --git a/lib/treemap.js b/lib/treemap.js new file mode 100644 index 00000000000..7918afa68c0 --- /dev/null +++ b/lib/treemap.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/treemap instead of lib/treemap +module.exports = require('../src/traces/treemap'); diff --git a/lib/violin.js b/lib/violin.js new file mode 100644 index 00000000000..74732a80e92 --- /dev/null +++ b/lib/violin.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/violin instead of lib/violin +module.exports = require('../src/traces/violin'); diff --git a/lib/volume.js b/lib/volume.js new file mode 100644 index 00000000000..c7d76529ba7 --- /dev/null +++ b/lib/volume.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/volume instead of lib/volume +module.exports = require('../src/traces/volume'); diff --git a/lib/waterfall.js b/lib/waterfall.js new file mode 100644 index 00000000000..a0484f2c74d --- /dev/null +++ b/lib/waterfall.js @@ -0,0 +1,3 @@ +'use strict'; +// deprecated in plotly.js v2 - one may use src/traces/waterfall instead of lib/waterfall +module.exports = require('../src/traces/waterfall'); diff --git a/tasks/partial_bundle.js b/tasks/partial_bundle.js index 74ed8b61c83..4a604cfd8bd 100644 --- a/tasks/partial_bundle.js +++ b/tasks/partial_bundle.js @@ -1,4 +1,3 @@ -var fs = require('fs'); var path = require('path'); var runSeries = require('run-series'); var prependFile = require('prepend-file'); @@ -8,8 +7,8 @@ var common = require('./util/common'); var _bundle = require('./util/browserify_wrapper'); var header = constants.licenseDist + '\n'; -var allTraces = fs.readdirSync(path.join(constants.pathToSrc, 'traces')); -var fullIndex = fs.readFileSync(constants.pathToPlotlyIndex, 'utf-8'); +var allTraces = constants.allTraces; +var mainIndex = constants.mainIndex; var argv = process.argv; @@ -61,7 +60,7 @@ function partialBundle(tasks, opts) { var traceList = opts.traceList; tasks.push(function(done) { - var partialIndex = fullIndex; + var partialIndex = mainIndex; allTraces.forEach(function(trace) { if(traceList.indexOf(trace) === -1) { var WHITESPACE_BEFORE = '\\s*'; diff --git a/tasks/preprocess.js b/tasks/preprocess.js index f88d9f31cb8..775154b38a4 100644 --- a/tasks/preprocess.js +++ b/tasks/preprocess.js @@ -1,4 +1,5 @@ var fs = require('fs-extra'); +var path = require('path'); var sass = require('node-sass'); var constants = require('./util/constants'); @@ -8,6 +9,7 @@ var updateVersion = require('./util/update_version'); // main makeBuildCSS(); +exposePartsInLib(); copyTopojsonFiles(); updateVersion(constants.pathToPlotlyVersion); @@ -24,6 +26,45 @@ function makeBuildCSS() { }); } +function exposePartsInLib() { + var obj = {}; + + var insert = function(name, folder) { + obj[name] = folder + '/' + name; + }; + + insert('calendars', 'src/components'); + + [ + 'aggregate', + 'filter', + 'groupby', + 'sort' + ].forEach(function(k) { + insert(k, 'src/transforms'); + }); + + constants.allTraces.forEach(function(k) { + insert(k, 'src/traces'); + }); + + writeLibFiles(obj); +} + +function writeLibFiles(obj) { + for(var name in obj) { + common.writeFile( + path.join(constants.pathToLib, name + '.js'), + [ + '\'use strict\';', + '// deprecated in plotly.js v2 - one may use ' + obj[name] + ' instead of ' + 'lib/' + name, + 'module.exports = require(\'../' + obj[name] + '\');', + '' + ].join('\n') + ); + } +} + // copy topojson files from sane-topojson to dist/ function copyTopojsonFiles() { fs.copy( diff --git a/tasks/util/constants.js b/tasks/util/constants.js index e727843480a..fe58e83f428 100644 --- a/tasks/util/constants.js +++ b/tasks/util/constants.js @@ -1,3 +1,4 @@ +var fs = require('fs'); var path = require('path'); var pkg = require('../../package.json'); @@ -10,6 +11,11 @@ var pathToVendor = path.join(pathToRoot, 'vendor/'); var pathToDist = path.join(pathToRoot, 'dist/'); var pathToBuild = path.join(pathToRoot, 'build/'); +var pathToPlotlyIndex = path.join(pathToLib, 'index.js'); +var mainIndex = fs.readFileSync(pathToPlotlyIndex, 'utf-8'); +var pathToPlotlyTraces = path.join(pathToSrc, 'traces'); +var allTraces = fs.readdirSync(pathToPlotlyTraces); + var pathToTopojsonSrc; try { pathToTopojsonSrc = path.join(path.dirname(require.resolve('sane-topojson')), 'dist/'); @@ -153,7 +159,10 @@ module.exports = { pathToVendor: pathToVendor, pathToDist: pathToDist, - pathToPlotlyIndex: path.join(pathToLib, 'index.js'), + allTraces: allTraces, + mainIndex: mainIndex, + pathToPlotlyIndex: pathToPlotlyIndex, + pathToPlotlyTraces: pathToPlotlyTraces, pathToPlotlyCore: path.join(pathToSrc, 'core.js'), pathToPlotlyVersion: path.join(pathToSrc, 'version.js'), pathToPlotlyBuild: path.join(pathToBuild, 'plotly.js'), From aeaf7093794f046500ebe028db63be27bf8d8153 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 10:53:07 -0500 Subject: [PATCH 07/15] modify util/constants to write index files for our partial bundles in lib folder - generated index files for our partial bundles using extra-bundles script --- lib/index-basic.js | 16 +++++++++++++ lib/index-cartesian.js | 25 +++++++++++++++++++++ lib/index-finance.js | 23 +++++++++++++++++++ lib/index-geo.js | 16 +++++++++++++ lib/index-gl2d.js | 19 ++++++++++++++++ lib/index-gl3d.js | 21 +++++++++++++++++ lib/index-mapbox.js | 17 ++++++++++++++ lib/index-strict.js | 50 +++++++++++++++++++++++++++++++++++++++++ tasks/util/constants.js | 2 +- 9 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 lib/index-basic.js create mode 100644 lib/index-cartesian.js create mode 100644 lib/index-finance.js create mode 100644 lib/index-geo.js create mode 100644 lib/index-gl2d.js create mode 100644 lib/index-gl3d.js create mode 100644 lib/index-mapbox.js create mode 100644 lib/index-strict.js diff --git a/lib/index-basic.js b/lib/index-basic.js new file mode 100644 index 00000000000..8d6517ca5bd --- /dev/null +++ b/lib/index-basic.js @@ -0,0 +1,16 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/bar'), + require('../src/traces/pie'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-cartesian.js b/lib/index-cartesian.js new file mode 100644 index 00000000000..caf58d749a6 --- /dev/null +++ b/lib/index-cartesian.js @@ -0,0 +1,25 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/bar'), + require('../src/traces/box'), + require('../src/traces/heatmap'), + require('../src/traces/histogram'), + require('../src/traces/histogram2d'), + require('../src/traces/histogram2dcontour'), + require('../src/traces/contour'), + require('../src/traces/scatterternary'), + require('../src/traces/violin'), + require('../src/traces/image'), + require('../src/traces/pie'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-finance.js b/lib/index-finance.js new file mode 100644 index 00000000000..de141955a63 --- /dev/null +++ b/lib/index-finance.js @@ -0,0 +1,23 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/bar'), + require('../src/traces/histogram'), + require('../src/traces/funnel'), + require('../src/traces/waterfall'), + require('../src/traces/pie'), + require('../src/traces/funnelarea'), + require('../src/traces/indicator'), + require('../src/traces/ohlc'), + require('../src/traces/candlestick'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-geo.js b/lib/index-geo.js new file mode 100644 index 00000000000..7c74cba3a05 --- /dev/null +++ b/lib/index-geo.js @@ -0,0 +1,16 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/scattergeo'), + require('../src/traces/choropleth'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-gl2d.js b/lib/index-gl2d.js new file mode 100644 index 00000000000..dc68894dd84 --- /dev/null +++ b/lib/index-gl2d.js @@ -0,0 +1,19 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/scattergl'), + require('../src/traces/splom'), + require('../src/traces/pointcloud'), + require('../src/traces/heatmapgl'), + require('../src/traces/parcoords'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-gl3d.js b/lib/index-gl3d.js new file mode 100644 index 00000000000..83fea7e268e --- /dev/null +++ b/lib/index-gl3d.js @@ -0,0 +1,21 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/scatter3d'), + require('../src/traces/surface'), + require('../src/traces/isosurface'), + require('../src/traces/volume'), + require('../src/traces/mesh3d'), + require('../src/traces/cone'), + require('../src/traces/streamtube'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-mapbox.js b/lib/index-mapbox.js new file mode 100644 index 00000000000..fe11b954fd9 --- /dev/null +++ b/lib/index-mapbox.js @@ -0,0 +1,17 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/scattermapbox'), + require('../src/traces/choroplethmapbox'), + require('../src/traces/densitymapbox'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-strict.js b/lib/index-strict.js new file mode 100644 index 00000000000..b5cbd7f7a4e --- /dev/null +++ b/lib/index-strict.js @@ -0,0 +1,50 @@ +'use strict'; + +var core = require('../src/core'); + +core.register([ + require('../src/traces/bar'), + require('../src/traces/box'), + require('../src/traces/heatmap'), + require('../src/traces/histogram'), + require('../src/traces/histogram2d'), + require('../src/traces/histogram2dcontour'), + require('../src/traces/contour'), + require('../src/traces/scatterternary'), + require('../src/traces/violin'), + require('../src/traces/funnel'), + require('../src/traces/waterfall'), + require('../src/traces/image'), + require('../src/traces/pie'), + require('../src/traces/sunburst'), + require('../src/traces/treemap'), + require('../src/traces/funnelarea'), + require('../src/traces/scattergeo'), + require('../src/traces/choropleth'), + require('../src/traces/scattergl'), + require('../src/traces/splom'), + require('../src/traces/parcoords'), + require('../src/traces/parcats'), + require('../src/traces/scattermapbox'), + require('../src/traces/choroplethmapbox'), + require('../src/traces/densitymapbox'), + require('../src/traces/sankey'), + require('../src/traces/indicator'), + require('../src/traces/table'), + require('../src/traces/carpet'), + require('../src/traces/scattercarpet'), + require('../src/traces/contourcarpet'), + require('../src/traces/ohlc'), + require('../src/traces/candlestick'), + require('../src/traces/scatterpolar'), + require('../src/traces/scatterpolargl'), + require('../src/traces/barpolar'), + + require('../src/transforms/aggregate'), + require('../src/transforms/filter'), + require('../src/transforms/groupby'), + require('../src/transforms/sort'), + require('../src/components/calendars') +]); + +module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/tasks/util/constants.js b/tasks/util/constants.js index fe58e83f428..1dbaf6fac8c 100644 --- a/tasks/util/constants.js +++ b/tasks/util/constants.js @@ -141,7 +141,7 @@ function makePartialBundleOpts(name) { return { name: name, traceList: partialBundleTraces[name], - index: path.join(pathToBuild, 'index-' + name + '.js'), + index: path.join(pathToLib, 'index-' + name + '.js'), dist: path.join(pathToDist, 'plotly-' + name + '.js'), distMin: path.join(pathToDist, 'plotly-' + name + '.min.js') }; From c937a6feede54ee7398289c0cd474e022f2f330c Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 12:54:00 -0500 Subject: [PATCH 08/15] do not deprecate components in lib in v2 --- lib/aggregate.js | 2 +- lib/bar.js | 2 +- lib/barpolar.js | 2 +- lib/box.js | 2 +- lib/calendars.js | 2 +- lib/candlestick.js | 2 +- lib/carpet.js | 2 +- lib/choropleth.js | 2 +- lib/choroplethmapbox.js | 2 +- lib/cone.js | 2 +- lib/contour.js | 2 +- lib/contourcarpet.js | 2 +- lib/densitymapbox.js | 2 +- lib/filter.js | 2 +- lib/funnel.js | 2 +- lib/funnelarea.js | 2 +- lib/groupby.js | 2 +- lib/heatmap.js | 2 +- lib/heatmapgl.js | 2 +- lib/histogram.js | 2 +- lib/histogram2d.js | 2 +- lib/histogram2dcontour.js | 2 +- lib/image.js | 2 +- lib/indicator.js | 2 +- lib/isosurface.js | 2 +- lib/mesh3d.js | 2 +- lib/ohlc.js | 2 +- lib/parcats.js | 2 +- lib/parcoords.js | 2 +- lib/pie.js | 2 +- lib/pointcloud.js | 2 +- lib/sankey.js | 2 +- lib/scatter.js | 2 +- lib/scatter3d.js | 2 +- lib/scattercarpet.js | 2 +- lib/scattergeo.js | 2 +- lib/scattergl.js | 2 +- lib/scattermapbox.js | 2 +- lib/scatterpolar.js | 2 +- lib/scatterpolargl.js | 2 +- lib/scatterternary.js | 2 +- lib/sort.js | 2 +- lib/splom.js | 2 +- lib/streamtube.js | 2 +- lib/sunburst.js | 2 +- lib/surface.js | 2 +- lib/table.js | 2 +- lib/treemap.js | 2 +- lib/violin.js | 2 +- lib/volume.js | 2 +- lib/waterfall.js | 2 +- tasks/preprocess.js | 2 +- 52 files changed, 52 insertions(+), 52 deletions(-) diff --git a/lib/aggregate.js b/lib/aggregate.js index 7ae520418d5..a076feab6c5 100644 --- a/lib/aggregate.js +++ b/lib/aggregate.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/transforms/aggregate instead of lib/aggregate + module.exports = require('../src/transforms/aggregate'); diff --git a/lib/bar.js b/lib/bar.js index 94275adcf59..53397793ff9 100644 --- a/lib/bar.js +++ b/lib/bar.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/bar instead of lib/bar + module.exports = require('../src/traces/bar'); diff --git a/lib/barpolar.js b/lib/barpolar.js index 82c01f50d8c..5791f600e7c 100644 --- a/lib/barpolar.js +++ b/lib/barpolar.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/barpolar instead of lib/barpolar + module.exports = require('../src/traces/barpolar'); diff --git a/lib/box.js b/lib/box.js index 146586eb7c4..4fc66201240 100644 --- a/lib/box.js +++ b/lib/box.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/box instead of lib/box + module.exports = require('../src/traces/box'); diff --git a/lib/calendars.js b/lib/calendars.js index 518b8b882fe..f197dad6716 100644 --- a/lib/calendars.js +++ b/lib/calendars.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/components/calendars instead of lib/calendars + module.exports = require('../src/components/calendars'); diff --git a/lib/candlestick.js b/lib/candlestick.js index 1fed8093379..438d3eaf22e 100644 --- a/lib/candlestick.js +++ b/lib/candlestick.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/candlestick instead of lib/candlestick + module.exports = require('../src/traces/candlestick'); diff --git a/lib/carpet.js b/lib/carpet.js index 49d17579229..cbc90b5c201 100644 --- a/lib/carpet.js +++ b/lib/carpet.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/carpet instead of lib/carpet + module.exports = require('../src/traces/carpet'); diff --git a/lib/choropleth.js b/lib/choropleth.js index 7d891ec5417..6fc96766e81 100644 --- a/lib/choropleth.js +++ b/lib/choropleth.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/choropleth instead of lib/choropleth + module.exports = require('../src/traces/choropleth'); diff --git a/lib/choroplethmapbox.js b/lib/choroplethmapbox.js index b9e6959a0f6..eebd007f658 100644 --- a/lib/choroplethmapbox.js +++ b/lib/choroplethmapbox.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/choroplethmapbox instead of lib/choroplethmapbox + module.exports = require('../src/traces/choroplethmapbox'); diff --git a/lib/cone.js b/lib/cone.js index c1b1acd97b6..63b1b490ff0 100644 --- a/lib/cone.js +++ b/lib/cone.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/cone instead of lib/cone + module.exports = require('../src/traces/cone'); diff --git a/lib/contour.js b/lib/contour.js index 8a83bc77c9a..3ed8332b64a 100644 --- a/lib/contour.js +++ b/lib/contour.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/contour instead of lib/contour + module.exports = require('../src/traces/contour'); diff --git a/lib/contourcarpet.js b/lib/contourcarpet.js index 3e0d2c56b1d..e5d16e9b71d 100644 --- a/lib/contourcarpet.js +++ b/lib/contourcarpet.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/contourcarpet instead of lib/contourcarpet + module.exports = require('../src/traces/contourcarpet'); diff --git a/lib/densitymapbox.js b/lib/densitymapbox.js index fd968bb20b2..6607531c90b 100644 --- a/lib/densitymapbox.js +++ b/lib/densitymapbox.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/densitymapbox instead of lib/densitymapbox + module.exports = require('../src/traces/densitymapbox'); diff --git a/lib/filter.js b/lib/filter.js index 34642aa3587..f53c81505c3 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/transforms/filter instead of lib/filter + module.exports = require('../src/transforms/filter'); diff --git a/lib/funnel.js b/lib/funnel.js index 02d1c47f085..434e1cc99ad 100644 --- a/lib/funnel.js +++ b/lib/funnel.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/funnel instead of lib/funnel + module.exports = require('../src/traces/funnel'); diff --git a/lib/funnelarea.js b/lib/funnelarea.js index a743a91b07e..e10ce6ec6ca 100644 --- a/lib/funnelarea.js +++ b/lib/funnelarea.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/funnelarea instead of lib/funnelarea + module.exports = require('../src/traces/funnelarea'); diff --git a/lib/groupby.js b/lib/groupby.js index 68567abe998..ca5334865b6 100644 --- a/lib/groupby.js +++ b/lib/groupby.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/transforms/groupby instead of lib/groupby + module.exports = require('../src/transforms/groupby'); diff --git a/lib/heatmap.js b/lib/heatmap.js index 399da36c170..668e97c3fc6 100644 --- a/lib/heatmap.js +++ b/lib/heatmap.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/heatmap instead of lib/heatmap + module.exports = require('../src/traces/heatmap'); diff --git a/lib/heatmapgl.js b/lib/heatmapgl.js index c09badbfe55..04be0e5ad86 100644 --- a/lib/heatmapgl.js +++ b/lib/heatmapgl.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/heatmapgl instead of lib/heatmapgl + module.exports = require('../src/traces/heatmapgl'); diff --git a/lib/histogram.js b/lib/histogram.js index 3aef42ab584..5468e89a96f 100644 --- a/lib/histogram.js +++ b/lib/histogram.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/histogram instead of lib/histogram + module.exports = require('../src/traces/histogram'); diff --git a/lib/histogram2d.js b/lib/histogram2d.js index f1384195381..3cb6bc5c680 100644 --- a/lib/histogram2d.js +++ b/lib/histogram2d.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/histogram2d instead of lib/histogram2d + module.exports = require('../src/traces/histogram2d'); diff --git a/lib/histogram2dcontour.js b/lib/histogram2dcontour.js index 8fa88e8bcc0..a8afc916ce3 100644 --- a/lib/histogram2dcontour.js +++ b/lib/histogram2dcontour.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/histogram2dcontour instead of lib/histogram2dcontour + module.exports = require('../src/traces/histogram2dcontour'); diff --git a/lib/image.js b/lib/image.js index 3078d067879..12c4105394c 100644 --- a/lib/image.js +++ b/lib/image.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/image instead of lib/image + module.exports = require('../src/traces/image'); diff --git a/lib/indicator.js b/lib/indicator.js index c1d2f360737..e9f5d384743 100644 --- a/lib/indicator.js +++ b/lib/indicator.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/indicator instead of lib/indicator + module.exports = require('../src/traces/indicator'); diff --git a/lib/isosurface.js b/lib/isosurface.js index eefe6b99430..569b4890eb1 100644 --- a/lib/isosurface.js +++ b/lib/isosurface.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/isosurface instead of lib/isosurface + module.exports = require('../src/traces/isosurface'); diff --git a/lib/mesh3d.js b/lib/mesh3d.js index 7185e0ef2fe..7b3ed28f705 100644 --- a/lib/mesh3d.js +++ b/lib/mesh3d.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/mesh3d instead of lib/mesh3d + module.exports = require('../src/traces/mesh3d'); diff --git a/lib/ohlc.js b/lib/ohlc.js index 895e0ab4fbd..681e52fbc8a 100644 --- a/lib/ohlc.js +++ b/lib/ohlc.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/ohlc instead of lib/ohlc + module.exports = require('../src/traces/ohlc'); diff --git a/lib/parcats.js b/lib/parcats.js index 669a6ec1a31..d7110b45fe3 100644 --- a/lib/parcats.js +++ b/lib/parcats.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/parcats instead of lib/parcats + module.exports = require('../src/traces/parcats'); diff --git a/lib/parcoords.js b/lib/parcoords.js index e8f5888c4b5..b86da9ddf10 100644 --- a/lib/parcoords.js +++ b/lib/parcoords.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/parcoords instead of lib/parcoords + module.exports = require('../src/traces/parcoords'); diff --git a/lib/pie.js b/lib/pie.js index 7cf4a0b1950..c105e4c705b 100644 --- a/lib/pie.js +++ b/lib/pie.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/pie instead of lib/pie + module.exports = require('../src/traces/pie'); diff --git a/lib/pointcloud.js b/lib/pointcloud.js index 9d46632882b..295cbe48ed6 100644 --- a/lib/pointcloud.js +++ b/lib/pointcloud.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/pointcloud instead of lib/pointcloud + module.exports = require('../src/traces/pointcloud'); diff --git a/lib/sankey.js b/lib/sankey.js index f791fdbf2dd..eac3e438989 100644 --- a/lib/sankey.js +++ b/lib/sankey.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/sankey instead of lib/sankey + module.exports = require('../src/traces/sankey'); diff --git a/lib/scatter.js b/lib/scatter.js index 5c8851b74ef..e0d55443d08 100644 --- a/lib/scatter.js +++ b/lib/scatter.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scatter instead of lib/scatter + module.exports = require('../src/traces/scatter'); diff --git a/lib/scatter3d.js b/lib/scatter3d.js index 10d06cd2ba4..f922b7237f9 100644 --- a/lib/scatter3d.js +++ b/lib/scatter3d.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scatter3d instead of lib/scatter3d + module.exports = require('../src/traces/scatter3d'); diff --git a/lib/scattercarpet.js b/lib/scattercarpet.js index 8d1f2eadc99..532ceba2c44 100644 --- a/lib/scattercarpet.js +++ b/lib/scattercarpet.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scattercarpet instead of lib/scattercarpet + module.exports = require('../src/traces/scattercarpet'); diff --git a/lib/scattergeo.js b/lib/scattergeo.js index 63e8becd688..566c9e262ea 100644 --- a/lib/scattergeo.js +++ b/lib/scattergeo.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scattergeo instead of lib/scattergeo + module.exports = require('../src/traces/scattergeo'); diff --git a/lib/scattergl.js b/lib/scattergl.js index 9e7bbe3d96f..c7e65b5c065 100644 --- a/lib/scattergl.js +++ b/lib/scattergl.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scattergl instead of lib/scattergl + module.exports = require('../src/traces/scattergl'); diff --git a/lib/scattermapbox.js b/lib/scattermapbox.js index d8550b65510..acc67f81d92 100644 --- a/lib/scattermapbox.js +++ b/lib/scattermapbox.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scattermapbox instead of lib/scattermapbox + module.exports = require('../src/traces/scattermapbox'); diff --git a/lib/scatterpolar.js b/lib/scatterpolar.js index f29bac62d82..744619551ed 100644 --- a/lib/scatterpolar.js +++ b/lib/scatterpolar.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scatterpolar instead of lib/scatterpolar + module.exports = require('../src/traces/scatterpolar'); diff --git a/lib/scatterpolargl.js b/lib/scatterpolargl.js index 281f83ab57e..380831b94c9 100644 --- a/lib/scatterpolargl.js +++ b/lib/scatterpolargl.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scatterpolargl instead of lib/scatterpolargl + module.exports = require('../src/traces/scatterpolargl'); diff --git a/lib/scatterternary.js b/lib/scatterternary.js index 120f29aa64a..33bbd5f033f 100644 --- a/lib/scatterternary.js +++ b/lib/scatterternary.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/scatterternary instead of lib/scatterternary + module.exports = require('../src/traces/scatterternary'); diff --git a/lib/sort.js b/lib/sort.js index 07c127115ee..5180b3299ff 100644 --- a/lib/sort.js +++ b/lib/sort.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/transforms/sort instead of lib/sort + module.exports = require('../src/transforms/sort'); diff --git a/lib/splom.js b/lib/splom.js index 8b93100865e..de34b05e8cb 100644 --- a/lib/splom.js +++ b/lib/splom.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/splom instead of lib/splom + module.exports = require('../src/traces/splom'); diff --git a/lib/streamtube.js b/lib/streamtube.js index 6dc26e72dd2..ec155612b9d 100644 --- a/lib/streamtube.js +++ b/lib/streamtube.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/streamtube instead of lib/streamtube + module.exports = require('../src/traces/streamtube'); diff --git a/lib/sunburst.js b/lib/sunburst.js index 4470ebf6ae9..2406eaa39b5 100644 --- a/lib/sunburst.js +++ b/lib/sunburst.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/sunburst instead of lib/sunburst + module.exports = require('../src/traces/sunburst'); diff --git a/lib/surface.js b/lib/surface.js index 84de66504d5..0f2e1f73163 100644 --- a/lib/surface.js +++ b/lib/surface.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/surface instead of lib/surface + module.exports = require('../src/traces/surface'); diff --git a/lib/table.js b/lib/table.js index 4d671d85ec5..9b725b6c867 100644 --- a/lib/table.js +++ b/lib/table.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/table instead of lib/table + module.exports = require('../src/traces/table'); diff --git a/lib/treemap.js b/lib/treemap.js index 7918afa68c0..5fde6c8828f 100644 --- a/lib/treemap.js +++ b/lib/treemap.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/treemap instead of lib/treemap + module.exports = require('../src/traces/treemap'); diff --git a/lib/violin.js b/lib/violin.js index 74732a80e92..37ca776d719 100644 --- a/lib/violin.js +++ b/lib/violin.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/violin instead of lib/violin + module.exports = require('../src/traces/violin'); diff --git a/lib/volume.js b/lib/volume.js index c7d76529ba7..00ddb1ec243 100644 --- a/lib/volume.js +++ b/lib/volume.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/volume instead of lib/volume + module.exports = require('../src/traces/volume'); diff --git a/lib/waterfall.js b/lib/waterfall.js index a0484f2c74d..529512264b3 100644 --- a/lib/waterfall.js +++ b/lib/waterfall.js @@ -1,3 +1,3 @@ 'use strict'; -// deprecated in plotly.js v2 - one may use src/traces/waterfall instead of lib/waterfall + module.exports = require('../src/traces/waterfall'); diff --git a/tasks/preprocess.js b/tasks/preprocess.js index 775154b38a4..a2266605551 100644 --- a/tasks/preprocess.js +++ b/tasks/preprocess.js @@ -57,7 +57,7 @@ function writeLibFiles(obj) { path.join(constants.pathToLib, name + '.js'), [ '\'use strict\';', - '// deprecated in plotly.js v2 - one may use ' + obj[name] + ' instead of ' + 'lib/' + name, + '', 'module.exports = require(\'../' + obj[name] + '\');', '' ].join('\n') From d29446e2a7350d97f44ab9758d8aee0061de4f6d Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 13:19:55 -0500 Subject: [PATCH 09/15] commit changes to lib when bumping version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e7751315567..b10c8780e85 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "start": "npm run start-test_dashboard", "baseline": "node tasks/baseline.js", "preversion": "check-node-version --node 12 --npm 6.14 && npm-link-check && npm ls --prod", - "version": "npm run build && npm run no-bad-char && git add -A dist build src/version.js", + "version": "npm run build && npm run no-bad-char && git add -A lib dist build src/version.js", "postversion": "node -e \"console.log('Version bumped and committed. If ok, run: git push && git push --tags')\"", "postpublish": "node tasks/sync_packages.js", "postshrinkwrap": "chttps ." From df672433adf6dc30069b4d5f30197d47a1907b37 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 13:41:22 -0500 Subject: [PATCH 10/15] keep core reference in lib --- lib/core.js | 3 ++ lib/index-basic.js | 20 +++++--- lib/index-cartesian.js | 38 +++++++------- lib/index-finance.js | 34 +++++++------ lib/index-geo.js | 20 +++++--- lib/index-gl2d.js | 26 +++++----- lib/index-gl3d.js | 30 +++++++----- lib/index-mapbox.js | 22 +++++---- lib/index-strict.js | 88 +++++++++++++++++---------------- lib/index.js | 106 +++++++++++++++++++++------------------- tasks/partial_bundle.js | 2 +- tasks/preprocess.js | 2 + 12 files changed, 216 insertions(+), 175 deletions(-) create mode 100644 lib/core.js diff --git a/lib/core.js b/lib/core.js new file mode 100644 index 00000000000..75182f42c07 --- /dev/null +++ b/lib/core.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../src/core'); diff --git a/lib/index-basic.js b/lib/index-basic.js index 8d6517ca5bd..39a19d2bd8e 100644 --- a/lib/index-basic.js +++ b/lib/index-basic.js @@ -1,16 +1,20 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/bar'), - require('../src/traces/pie'), + // traces + require('./bar'), + require('./pie'), - require('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-cartesian.js b/lib/index-cartesian.js index caf58d749a6..38b23d56803 100644 --- a/lib/index-cartesian.js +++ b/lib/index-cartesian.js @@ -1,25 +1,29 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/bar'), - require('../src/traces/box'), - require('../src/traces/heatmap'), - require('../src/traces/histogram'), - require('../src/traces/histogram2d'), - require('../src/traces/histogram2dcontour'), - require('../src/traces/contour'), - require('../src/traces/scatterternary'), - require('../src/traces/violin'), - require('../src/traces/image'), - require('../src/traces/pie'), + // traces + require('./bar'), + require('./box'), + require('./heatmap'), + require('./histogram'), + require('./histogram2d'), + require('./histogram2dcontour'), + require('./contour'), + require('./scatterternary'), + require('./violin'), + require('./image'), + require('./pie'), - require('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-finance.js b/lib/index-finance.js index de141955a63..9903a2a3b1a 100644 --- a/lib/index-finance.js +++ b/lib/index-finance.js @@ -1,23 +1,27 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/bar'), - require('../src/traces/histogram'), - require('../src/traces/funnel'), - require('../src/traces/waterfall'), - require('../src/traces/pie'), - require('../src/traces/funnelarea'), - require('../src/traces/indicator'), - require('../src/traces/ohlc'), - require('../src/traces/candlestick'), + // traces + require('./bar'), + require('./histogram'), + require('./funnel'), + require('./waterfall'), + require('./pie'), + require('./funnelarea'), + require('./indicator'), + require('./ohlc'), + require('./candlestick'), - require('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-geo.js b/lib/index-geo.js index 7c74cba3a05..fec146d7035 100644 --- a/lib/index-geo.js +++ b/lib/index-geo.js @@ -1,16 +1,20 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/scattergeo'), - require('../src/traces/choropleth'), + // traces + require('./scattergeo'), + require('./choropleth'), - require('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-gl2d.js b/lib/index-gl2d.js index dc68894dd84..4d4024f197d 100644 --- a/lib/index-gl2d.js +++ b/lib/index-gl2d.js @@ -1,19 +1,23 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/scattergl'), - require('../src/traces/splom'), - require('../src/traces/pointcloud'), - require('../src/traces/heatmapgl'), - require('../src/traces/parcoords'), + // traces + require('./scattergl'), + require('./splom'), + require('./pointcloud'), + require('./heatmapgl'), + require('./parcoords'), - require('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-gl3d.js b/lib/index-gl3d.js index 83fea7e268e..8cfb6e4be26 100644 --- a/lib/index-gl3d.js +++ b/lib/index-gl3d.js @@ -1,21 +1,25 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/scatter3d'), - require('../src/traces/surface'), - require('../src/traces/isosurface'), - require('../src/traces/volume'), - require('../src/traces/mesh3d'), - require('../src/traces/cone'), - require('../src/traces/streamtube'), + // traces + require('./scatter3d'), + require('./surface'), + require('./isosurface'), + require('./volume'), + require('./mesh3d'), + require('./cone'), + require('./streamtube'), - require('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-mapbox.js b/lib/index-mapbox.js index fe11b954fd9..928da27bfab 100644 --- a/lib/index-mapbox.js +++ b/lib/index-mapbox.js @@ -1,17 +1,21 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/scattermapbox'), - require('../src/traces/choroplethmapbox'), - require('../src/traces/densitymapbox'), + // traces + require('./scattermapbox'), + require('./choroplethmapbox'), + require('./densitymapbox'), - require('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index-strict.js b/lib/index-strict.js index b5cbd7f7a4e..188d1370c9d 100644 --- a/lib/index-strict.js +++ b/lib/index-strict.js @@ -1,50 +1,54 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/bar'), - require('../src/traces/box'), - require('../src/traces/heatmap'), - require('../src/traces/histogram'), - require('../src/traces/histogram2d'), - require('../src/traces/histogram2dcontour'), - require('../src/traces/contour'), - require('../src/traces/scatterternary'), - require('../src/traces/violin'), - require('../src/traces/funnel'), - require('../src/traces/waterfall'), - require('../src/traces/image'), - require('../src/traces/pie'), - require('../src/traces/sunburst'), - require('../src/traces/treemap'), - require('../src/traces/funnelarea'), - require('../src/traces/scattergeo'), - require('../src/traces/choropleth'), - require('../src/traces/scattergl'), - require('../src/traces/splom'), - require('../src/traces/parcoords'), - require('../src/traces/parcats'), - require('../src/traces/scattermapbox'), - require('../src/traces/choroplethmapbox'), - require('../src/traces/densitymapbox'), - require('../src/traces/sankey'), - require('../src/traces/indicator'), - require('../src/traces/table'), - require('../src/traces/carpet'), - require('../src/traces/scattercarpet'), - require('../src/traces/contourcarpet'), - require('../src/traces/ohlc'), - require('../src/traces/candlestick'), - require('../src/traces/scatterpolar'), - require('../src/traces/scatterpolargl'), - require('../src/traces/barpolar'), + // traces + 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('./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('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/lib/index.js b/lib/index.js index d3be17f675f..46aa2598969 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,59 +1,63 @@ 'use strict'; -var core = require('../src/core'); +var core = require('./core'); core.register([ - require('../src/traces/bar'), - require('../src/traces/box'), - require('../src/traces/heatmap'), - require('../src/traces/histogram'), - require('../src/traces/histogram2d'), - require('../src/traces/histogram2dcontour'), - require('../src/traces/contour'), - require('../src/traces/scatterternary'), - require('../src/traces/violin'), - require('../src/traces/funnel'), - require('../src/traces/waterfall'), - require('../src/traces/image'), - require('../src/traces/pie'), - require('../src/traces/sunburst'), - require('../src/traces/treemap'), - require('../src/traces/funnelarea'), - require('../src/traces/scatter3d'), - require('../src/traces/surface'), - require('../src/traces/isosurface'), - require('../src/traces/volume'), - require('../src/traces/mesh3d'), - require('../src/traces/cone'), - require('../src/traces/streamtube'), - require('../src/traces/scattergeo'), - require('../src/traces/choropleth'), - require('../src/traces/scattergl'), - require('../src/traces/splom'), - require('../src/traces/pointcloud'), - require('../src/traces/heatmapgl'), - require('../src/traces/parcoords'), - require('../src/traces/parcats'), - require('../src/traces/scattermapbox'), - require('../src/traces/choroplethmapbox'), - require('../src/traces/densitymapbox'), - require('../src/traces/sankey'), - require('../src/traces/indicator'), - require('../src/traces/table'), - require('../src/traces/carpet'), - require('../src/traces/scattercarpet'), - require('../src/traces/contourcarpet'), - require('../src/traces/ohlc'), - require('../src/traces/candlestick'), - require('../src/traces/scatterpolar'), - require('../src/traces/scatterpolargl'), - require('../src/traces/barpolar'), + // traces + 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('./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('../src/transforms/aggregate'), - require('../src/transforms/filter'), - require('../src/transforms/groupby'), - require('../src/transforms/sort'), - require('../src/components/calendars') + // transforms + require('./aggregate'), + require('./filter'), + require('./groupby'), + require('./sort'), + + // components + require('./calendars') ]); module.exports = (function(Plotly) { return Plotly; })(core); diff --git a/tasks/partial_bundle.js b/tasks/partial_bundle.js index 4a604cfd8bd..9b15451cee5 100644 --- a/tasks/partial_bundle.js +++ b/tasks/partial_bundle.js @@ -68,7 +68,7 @@ function partialBundle(tasks, opts) { var newCode = partialIndex.replace( new RegExp( WHITESPACE_BEFORE + - 'require\\(\'\\.\\./src/traces/' + trace + '\'\\),', + 'require\\(\'\\./' + trace + '\'\\),', 'g'), '' ); diff --git a/tasks/preprocess.js b/tasks/preprocess.js index a2266605551..e2716c1ba4c 100644 --- a/tasks/preprocess.js +++ b/tasks/preprocess.js @@ -33,6 +33,8 @@ function exposePartsInLib() { obj[name] = folder + '/' + name; }; + insert('core', 'src'); + insert('calendars', 'src/components'); [ From 4772f90a54dd5eb18425b90dac82c2bee48e4a30 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 13:50:31 -0500 Subject: [PATCH 11/15] reference lib in bundle tests where possible --- test/jasmine/bundle_tests/bar_test.js | 4 ++-- test/jasmine/bundle_tests/choropleth_test.js | 4 ++-- .../jasmine/bundle_tests/component_first_test.js | 10 +++++----- test/jasmine/bundle_tests/component_last_test.js | 10 +++++----- test/jasmine/bundle_tests/contour_test.js | 4 ++-- test/jasmine/bundle_tests/core_test.js | 2 +- test/jasmine/bundle_tests/dynamic_import_test.js | 4 ++-- test/jasmine/bundle_tests/finance_test.js | 6 +++--- .../bundle_tests/histogram2dcontour_test.js | 6 +++--- test/jasmine/bundle_tests/plotschema_test.js | 16 ++++++++-------- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/test/jasmine/bundle_tests/bar_test.js b/test/jasmine/bundle_tests/bar_test.js index 5803f1bfed8..03ab0f667d4 100644 --- a/test/jasmine/bundle_tests/bar_test.js +++ b/test/jasmine/bundle_tests/bar_test.js @@ -1,7 +1,7 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@src/core'); -var PlotlyBar = require('@src/traces/bar'); +var Plotly = require('@lib/core'); +var PlotlyBar = require('@lib/bar'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/choropleth_test.js b/test/jasmine/bundle_tests/choropleth_test.js index dfd345c3987..221b742c77b 100644 --- a/test/jasmine/bundle_tests/choropleth_test.js +++ b/test/jasmine/bundle_tests/choropleth_test.js @@ -1,7 +1,7 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@src/core'); -var PlotlyChoropleth = require('@src/traces/choropleth'); +var Plotly = require('@lib/core'); +var PlotlyChoropleth = require('@lib/choropleth'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/component_first_test.js b/test/jasmine/bundle_tests/component_first_test.js index c57417f5fce..0b6bd24e9da 100644 --- a/test/jasmine/bundle_tests/component_first_test.js +++ b/test/jasmine/bundle_tests/component_first_test.js @@ -1,8 +1,8 @@ -var Plotly = require('@src/core'); -var Bar = require('@src/traces/bar'); -var Scatter3d = require('@src/traces/scatter3d'); -var Filter = require('@src/transforms/filter'); -var Calendars = require('@src/components/calendars'); +var Plotly = require('@lib/core'); +var Bar = require('@lib/bar'); +var Scatter3d = require('@lib/scatter3d'); +var Filter = require('@lib/filter'); +var Calendars = require('@lib/calendars'); var checkComponent = require('../assets/check_component'); diff --git a/test/jasmine/bundle_tests/component_last_test.js b/test/jasmine/bundle_tests/component_last_test.js index 6da14e8b701..f0227ca102e 100644 --- a/test/jasmine/bundle_tests/component_last_test.js +++ b/test/jasmine/bundle_tests/component_last_test.js @@ -1,8 +1,8 @@ -var Plotly = require('@src/core'); -var Bar = require('@src/traces/bar'); -var Scatter3d = require('@src/traces/scatter3d'); -var Filter = require('@src/transforms/filter'); -var Calendars = require('@src/components/calendars'); +var Plotly = require('@lib/core'); +var Bar = require('@lib/bar'); +var Scatter3d = require('@lib/scatter3d'); +var Filter = require('@lib/filter'); +var Calendars = require('@lib/calendars'); var checkComponent = require('../assets/check_component'); diff --git a/test/jasmine/bundle_tests/contour_test.js b/test/jasmine/bundle_tests/contour_test.js index 96d8de0433f..96a225b5a59 100644 --- a/test/jasmine/bundle_tests/contour_test.js +++ b/test/jasmine/bundle_tests/contour_test.js @@ -1,7 +1,7 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@src/core'); -var PlotlyContour = require('@src/traces/contour'); +var Plotly = require('@lib/core'); +var PlotlyContour = require('@lib/contour'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/core_test.js b/test/jasmine/bundle_tests/core_test.js index af09cdf1c22..9140dbbe075 100644 --- a/test/jasmine/bundle_tests/core_test.js +++ b/test/jasmine/bundle_tests/core_test.js @@ -1,6 +1,6 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@src/core'); +var Plotly = require('@lib/core'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/dynamic_import_test.js b/test/jasmine/bundle_tests/dynamic_import_test.js index 0ffb45e52c2..5dc42374ded 100644 --- a/test/jasmine/bundle_tests/dynamic_import_test.js +++ b/test/jasmine/bundle_tests/dynamic_import_test.js @@ -1,4 +1,4 @@ -var Plotly = require('@src/core'); +var Plotly = require('@lib/core'); var d3Select = require('../../strict-d3').select; var createGraphDiv = require('../assets/create_graph_div'); @@ -20,7 +20,7 @@ describe('Dynamic @lib/ module imports', function() { // N.B. from a different subplot type // more info in: // https://github.com/plotly/plotly.js/issues/3428 - var ScatterPolar = require('@src/traces/scatterpolar'); + var ScatterPolar = require('@lib/scatterpolar'); Plotly.register(ScatterPolar); }) .then(function() { diff --git a/test/jasmine/bundle_tests/finance_test.js b/test/jasmine/bundle_tests/finance_test.js index 9f0143a07d4..12a5926e10f 100644 --- a/test/jasmine/bundle_tests/finance_test.js +++ b/test/jasmine/bundle_tests/finance_test.js @@ -1,7 +1,7 @@ var Plots = require('@src/plots/plots'); -var Plotly = require('@src/core'); -var ohlc = require('@src/traces/ohlc'); -var candlestick = require('@src/traces/candlestick'); +var Plotly = require('@lib/core'); +var ohlc = require('@lib/ohlc'); +var candlestick = require('@lib/candlestick'); var d3Select = require('../../strict-d3').select; var createGraphDiv = require('../assets/create_graph_div'); diff --git a/test/jasmine/bundle_tests/histogram2dcontour_test.js b/test/jasmine/bundle_tests/histogram2dcontour_test.js index a263b5d26e2..d65868e050d 100644 --- a/test/jasmine/bundle_tests/histogram2dcontour_test.js +++ b/test/jasmine/bundle_tests/histogram2dcontour_test.js @@ -1,8 +1,8 @@ var d3SelectAll = require('../../strict-d3').selectAll; -var Plotly = require('@src/core'); -var PlotlyHistogram2dContour = require('@src/traces/histogram2dcontour'); -var PlotlyHistogram = require('@src/traces/histogram'); +var Plotly = require('@lib/core'); +var PlotlyHistogram2dContour = require('@lib/histogram2dcontour'); +var PlotlyHistogram = require('@lib/histogram'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); diff --git a/test/jasmine/bundle_tests/plotschema_test.js b/test/jasmine/bundle_tests/plotschema_test.js index 59cdf9ca0f1..a8839522a92 100644 --- a/test/jasmine/bundle_tests/plotschema_test.js +++ b/test/jasmine/bundle_tests/plotschema_test.js @@ -4,9 +4,9 @@ var Lib = require('@src/lib'); var Registry = require('@src/registry'); var baseAttrs = require('@src/plots/attributes'); -var scatter = require('@src/traces/scatter'); -var parcoords = require('@src/traces/parcoords'); -var surface = require('@src/traces/surface'); +var scatter = require('@lib/scatter'); +var parcoords = require('@lib/parcoords'); +var surface = require('@lib/surface'); var baseLayoutAttrs = require('@src/plots/layout_attributes'); var cartesianAttrs = require('@src/plots/cartesian').layoutAttributes; @@ -444,7 +444,7 @@ describe('getTraceValObject', function() { {type: 'groupby'} ]}; - var filterAttrs = require('@src/transforms/filter').attributes; + var filterAttrs = require('@lib/filter').attributes; expect(getTraceValObject(mockTrace, ['transforms', 0, 'operation'])) .toBe(filterAttrs.operation); // check a component-provided attr @@ -452,7 +452,7 @@ describe('getTraceValObject', function() { .toBe(filterAttrs.valuecalendar); expect(getTraceValObject(mockTrace, ['transforms', 1, 'styles', 13, 'value', 'line', 'color'])) - .toBe(require('@src/transforms/groupby').attributes.styles.value); + .toBe(require('@lib/groupby').attributes.styles.value); [ ['transforms', 0], @@ -498,13 +498,13 @@ describe('getLayoutValObject', function() { it('finds trace layout attributes', function() { var layoutBar = {_modules: [Registry.modules.bar._module]}; expect(getLayoutValObject(layoutBar, ['barmode'])) - .toBe(require('@src/traces/bar').layoutAttributes.barmode); + .toBe(require('@lib/bar').layoutAttributes.barmode); var layoutBox = {_modules: [Registry.modules.box._module]}; expect(getLayoutValObject(layoutBox, ['boxgap'])) - .toBe(require('@src/traces/box').layoutAttributes.boxgap); + .toBe(require('@lib/box').layoutAttributes.boxgap); var layoutPie = {_modules: [Registry.modules.pie._module]}; expect(getLayoutValObject(layoutPie, ['hiddenlabels'])) - .toBe(require('@src/traces/pie').layoutAttributes.hiddenlabels); + .toBe(require('@lib/pie').layoutAttributes.hiddenlabels); // not found when these traces are unused on the plot expect(getLayoutValObject(blankLayout, ['barmode'])).toBe(false); From e1c4cc3619256591138e0135c1bb0c34861fa6d3 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 14:11:19 -0500 Subject: [PATCH 12/15] update README --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 196a06f4885..9ab9e3e1f73 100644 --- a/README.md +++ b/README.md @@ -75,8 +75,29 @@ Starting in `v1.15.0`, plotly.js ships with several _partial_ bundles (more info Starting in `v1.39.0`, plotly.js publishes _distributed_ npm packages with no dependencies. For example, run `npm install plotly.js-geo-dist` and add `import Plotly from 'plotly.js-geo-dist';` to your code to start using the plotly.js geo package. -If none of the distributed npm packages meet your needs, you create custom bundle of desired trace modules e.g. `pie` and `sunburst` using -`npm run partial-bundle pie sunburst name=custom` +If none of the distributed npm packages meet your needs, and you would like to manually pick which plotly.js modules to include, you'll first need to run `npm install plotly.js` and then create a *custom* bundle by using `plotly.js/lib/core`, and loading only the trace types that you need (e.g. `pie` or `choropleth`). The recommended way to do this is by creating a *bundling file*. For example, in CommonJS: + +```javascript +// in custom-plotly.js +var Plotly = require('plotly.js/lib/core'); + +// Load in the trace types for pie, and choropleth +Plotly.register([ + require('plotly.js/lib/pie'), + require('plotly.js/lib/choropleth') +]); + +module.exports = Plotly; +``` + +Then elsewhere in your code: + +```javascript +var Plotly = require('./path/to/custom-plotly'); +``` + +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` ## Building plotly.js From 8d902aadcb66dccf945101584b3b202a350cc5a9 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 14:35:01 -0500 Subject: [PATCH 13/15] use --name in partial bundle script --- README.md | 2 +- tasks/partial_bundle.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ab9e3e1f73..5143f7412b1 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ var Plotly = require('./path/to/custom-plotly'); ``` 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` +`npm run partial-bundle pie choropleth --name=custom` ## Building plotly.js diff --git a/tasks/partial_bundle.js b/tasks/partial_bundle.js index 9b15451cee5..42859b4578a 100644 --- a/tasks/partial_bundle.js +++ b/tasks/partial_bundle.js @@ -26,7 +26,7 @@ if(argv.length > 2) { ) { traceList.push(a); } - if(a.indexOf('name=') !== -1) name = a.replace('name=', ''); + if(a.indexOf('--name=') === 0) name = a.replace('--name=', ''); } if(!name) name = 'custom'; traceList = traceList.sort(); From 0d00c52292b872daf24c455e8c246e0403591d0e Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 15:03:29 -0500 Subject: [PATCH 14/15] add comment to the end of lib/index files --- lib/index-basic.js | 12 +++++++++--- lib/index-cartesian.js | 12 +++++++++--- lib/index-finance.js | 12 +++++++++--- lib/index-geo.js | 12 +++++++++--- lib/index-gl2d.js | 12 +++++++++--- lib/index-gl3d.js | 12 +++++++++--- lib/index-mapbox.js | 12 +++++++++--- lib/index-strict.js | 12 +++++++++--- lib/index.js | 12 +++++++++--- 9 files changed, 81 insertions(+), 27 deletions(-) diff --git a/lib/index-basic.js b/lib/index-basic.js index 39a19d2bd8e..ad1650dcfca 100644 --- a/lib/index-basic.js +++ b/lib/index-basic.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./bar'), require('./pie'), @@ -17,4 +17,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index-cartesian.js b/lib/index-cartesian.js index 38b23d56803..92e35f9e395 100644 --- a/lib/index-cartesian.js +++ b/lib/index-cartesian.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./bar'), require('./box'), @@ -26,4 +26,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index-finance.js b/lib/index-finance.js index 9903a2a3b1a..a7bbbfe9c05 100644 --- a/lib/index-finance.js +++ b/lib/index-finance.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./bar'), require('./histogram'), @@ -24,4 +24,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index-geo.js b/lib/index-geo.js index fec146d7035..802b55c5f47 100644 --- a/lib/index-geo.js +++ b/lib/index-geo.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./scattergeo'), require('./choropleth'), @@ -17,4 +17,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index-gl2d.js b/lib/index-gl2d.js index 4d4024f197d..1957b77bff3 100644 --- a/lib/index-gl2d.js +++ b/lib/index-gl2d.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./scattergl'), require('./splom'), @@ -20,4 +20,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index-gl3d.js b/lib/index-gl3d.js index 8cfb6e4be26..cf6ea9394f2 100644 --- a/lib/index-gl3d.js +++ b/lib/index-gl3d.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./scatter3d'), require('./surface'), @@ -22,4 +22,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index-mapbox.js b/lib/index-mapbox.js index 928da27bfab..9c285aee424 100644 --- a/lib/index-mapbox.js +++ b/lib/index-mapbox.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./scattermapbox'), require('./choroplethmapbox'), @@ -18,4 +18,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index-strict.js b/lib/index-strict.js index 188d1370c9d..3b402d877f0 100644 --- a/lib/index-strict.js +++ b/lib/index-strict.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./bar'), require('./box'), @@ -51,4 +51,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); diff --git a/lib/index.js b/lib/index.js index 46aa2598969..240fc06b5a6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,8 +1,8 @@ 'use strict'; -var core = require('./core'); +var Plotly = require('./core'); -core.register([ +Plotly.register([ // traces require('./bar'), require('./box'), @@ -60,4 +60,10 @@ core.register([ require('./calendars') ]); -module.exports = (function(Plotly) { return Plotly; })(core); +// Using +// module.exports = Plotly; +// here often make unrecognized characters (from d3 - v3) in the bundles +// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE +// to return the Plotly object. +// It’s a hack to fix encoding problems and we’ll remove it after we solve those. +module.exports = (function(_Plotly) { return _Plotly; })(Plotly); From a66d56a0f0f89c4f718af7cabec20b0c08edc90a Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 22 Feb 2021 15:29:15 -0500 Subject: [PATCH 15/15] simple Plotly return from index --- lib/index-basic.js | 8 +------- lib/index-cartesian.js | 8 +------- lib/index-finance.js | 8 +------- lib/index-geo.js | 8 +------- lib/index-gl2d.js | 8 +------- lib/index-gl3d.js | 8 +------- lib/index-mapbox.js | 8 +------- lib/index-strict.js | 8 +------- lib/index.js | 8 +------- 9 files changed, 9 insertions(+), 63 deletions(-) diff --git a/lib/index-basic.js b/lib/index-basic.js index ad1650dcfca..670ce848e90 100644 --- a/lib/index-basic.js +++ b/lib/index-basic.js @@ -17,10 +17,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index-cartesian.js b/lib/index-cartesian.js index 92e35f9e395..085283666eb 100644 --- a/lib/index-cartesian.js +++ b/lib/index-cartesian.js @@ -26,10 +26,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index-finance.js b/lib/index-finance.js index a7bbbfe9c05..d88c44bb8fc 100644 --- a/lib/index-finance.js +++ b/lib/index-finance.js @@ -24,10 +24,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index-geo.js b/lib/index-geo.js index 802b55c5f47..35302c4e32a 100644 --- a/lib/index-geo.js +++ b/lib/index-geo.js @@ -17,10 +17,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index-gl2d.js b/lib/index-gl2d.js index 1957b77bff3..e71369e7019 100644 --- a/lib/index-gl2d.js +++ b/lib/index-gl2d.js @@ -20,10 +20,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index-gl3d.js b/lib/index-gl3d.js index cf6ea9394f2..37b556c1b88 100644 --- a/lib/index-gl3d.js +++ b/lib/index-gl3d.js @@ -22,10 +22,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index-mapbox.js b/lib/index-mapbox.js index 9c285aee424..8d2d99344be 100644 --- a/lib/index-mapbox.js +++ b/lib/index-mapbox.js @@ -18,10 +18,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index-strict.js b/lib/index-strict.js index 3b402d877f0..93f145adfd1 100644 --- a/lib/index-strict.js +++ b/lib/index-strict.js @@ -51,10 +51,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly; diff --git a/lib/index.js b/lib/index.js index 240fc06b5a6..97a15b89cbb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -60,10 +60,4 @@ Plotly.register([ require('./calendars') ]); -// Using -// module.exports = Plotly; -// here often make unrecognized characters (from d3 - v3) in the bundles -// For now we use an IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE -// to return the Plotly object. -// It’s a hack to fix encoding problems and we’ll remove it after we solve those. -module.exports = (function(_Plotly) { return _Plotly; })(Plotly); +module.exports = Plotly;