Skip to content

Commit d3087b1

Browse files
committed
add index file exporting only API Plotly methods:
- browserify that file so that window.Plotly doesn't contain internal methods
1 parent 3349e7b commit d3087b1

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "The premier javascript graphing library",
55
"license": "MIT",
6-
"main": "./src/plotly.js",
6+
"main": "./src/index.js",
77
"repository": {
88
"type": "git",
99
"url": "https://github.com/plotly/plotly.js.git"

src/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Export the plotly.js API methods.
3+
*
4+
* This file is browserify'ed into a standalone 'Plotly' object.
5+
*
6+
*/
7+
8+
var Plotly = require('./plotly');
9+
10+
// plot api
11+
exports.plot = Plotly.plot;
12+
exports.newPlot = Plotly.newPlot;
13+
exports.restyle = Plotly.restyle;
14+
exports.relayout = Plotly.relayout;
15+
exports.redraw = Plotly.redraw;
16+
exports.extendTraces = Plotly.extendTraces;
17+
exports.prependTraces = Plotly.prependTraces;
18+
exports.addTraces = Plotly.addTraces;
19+
exports.deleteTraces = Plotly.deleteTraces;
20+
exports.moveTraces = Plotly.moveTraces;
21+
22+
// unofficial plot methods, use at your own risk
23+
exports.Plots = Plotly.Plots;
24+
exports.Fx = Plotly.Fx;
25+
26+
// TODO expose snapshot and plot_schema
27+
28+
// export d3 used in the bundle
29+
exports.d3 = require('d3');

src/plotly.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,3 @@ exports.Snapshot = require('./snapshot/snapshot');
5858

5959
// queue for undo/redo
6060
exports.Queue = require('./lib/queue');
61-
62-
// export d3 used in the bundle
63-
exports.d3 = require('d3');

tasks/util/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
pathToSrc: pathToSrc,
1111
pathToMocks: path.join(pathToRoot, 'test/image/mocks'),
1212

13-
pathToPlotlySrc: path.join(pathToSrc, 'plotly.js'),
13+
pathToPlotlySrc: path.join(pathToSrc, 'index.js'),
1414
pathToPlotlyDist: path.join(pathToDist, 'plotly.js'),
1515
pathToPlotlyDistMin: path.join(pathToDist, 'plotly.min.js'),
1616
pathToPlotlyDistWithMeta: path.join(pathToDist, 'plotly-with-meta.js'),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy