@@ -108,6 +108,7 @@ function getMainBundleInfo() {
108
108
'- using CDN URL ' + cdnRoot + 'latest' + MINJS + ' OR ' + cdnRoot + pkg . version + MINJS ,
109
109
'' ,
110
110
'or as raw javascript:' ,
111
+ '- using the `plotly.js-dist` npm package (starting in `v1.39.0`)' ,
111
112
'- using dist file `dist/plotly.js`' ,
112
113
'- using CDN URL ' + cdnRoot + 'latest' + JS + ' OR ' + cdnRoot + pkg . version + JS ,
113
114
'- using CommonJS with `require(\'plotly.js\')`' ,
@@ -127,7 +128,8 @@ function getMainBundleInfo() {
127
128
'Starting in `v1.15.0`, plotly.js also ships with several _partial_ bundles:' ,
128
129
'' ,
129
130
constants . partialBundlePaths . map ( makeBundleHeaderInfo ) . join ( '\n' ) ,
130
- ''
131
+ '' ,
132
+ 'Starting in `v1.39.0`, each plotly.js partial bundle has a corresponding npm package with no dependency.'
131
133
] ;
132
134
}
133
135
@@ -155,25 +157,54 @@ function makeBundleInfo(pathObj) {
155
157
var name = pathObj . name ;
156
158
var sizes = findSizes ( pathObj ) ;
157
159
var moduleList = common . findModuleList ( pathObj . index ) ;
160
+ var pkgName = 'plotly.js-' + name + '-dist' ;
158
161
159
162
return [
160
163
'### plotly.js ' + name ,
161
164
'' ,
162
165
'The `' + name + '` partial bundle contains trace modules ' + common . formatEnumeration ( moduleList ) + '.' ,
163
166
'' ,
164
- '| Way to import | Location |' ,
165
- '|---------------|----------|' ,
166
- '| dist bundle | ' + '`dist/plotly-' + name + JS + '` |' ,
167
- '| dist bundle (minified) | ' + '`dist/plotly-' + name + MINJS + '` |' ,
167
+ '#### Stats' ,
168
+ '' ,
169
+ '| Raw size | Minified size | Minified + gzip size |' ,
170
+ '|------|-----------------|------------------------|' ,
171
+ '| ' + sizes . raw + ' | ' + sizes . minified + ' | ' + sizes . gzipped + ' |' ,
172
+ '' ,
173
+ '#### CDN links' ,
174
+ '' ,
175
+ '| Flavor | URL |' ,
176
+ '| ------ | --- |' ,
168
177
'| CDN URL (latest) | ' + cdnRoot + name + '-latest' + JS + ' |' ,
169
178
'| CDN URL (latest minified) | ' + cdnRoot + name + '-latest' + MINJS + ' |' ,
170
179
'| CDN URL (tagged) | ' + cdnRoot + name + '-' + pkg . version + JS + ' |' ,
171
180
'| CDN URL (tagged minified) | ' + cdnRoot + name + '-' + pkg . version + MINJS + ' |' ,
181
+ '' ,
182
+ '#### npm package (starting in `v1.39.0`)' ,
183
+ '' ,
184
+ 'Install with' ,
185
+ '```' ,
186
+ 'npm install ' + pkgName ,
187
+ '```' ,
188
+ '' ,
189
+ 'ES6 module usage:' ,
190
+ '```js' ,
191
+ 'import Plotly from \'' + pkgName + '\'' ,
192
+ '```' ,
193
+ '' ,
194
+ 'CommonJS usage:' ,
195
+ '```js' ,
196
+ 'var Plotly = require(\'' + pkgName + '\');' ,
197
+ '```' ,
198
+ '' ,
199
+ '#### plotly.js dist files' ,
200
+ '' ,
201
+ '| Way to import | Location |' ,
202
+ '|---------------|----------|' ,
203
+ '| dist bundle | ' + '`dist/plotly-' + name + JS + '` |' ,
204
+ '| dist bundle (minified) | ' + '`dist/plotly-' + name + MINJS + '` |' ,
205
+ '| ES6 module | ' + '`import Plotly from \'plotly.js/lib/' + 'index-' + name + '\'`' + ' |' ,
172
206
'| CommonJS | ' + '`require(\'plotly.js/lib/' + 'index-' + name + '\')`' + ' |' ,
173
207
'' ,
174
- '| Raw size | Minified size | Minified + gzip size |' ,
175
- '|------|-----------------|------------------------|' ,
176
- '| ' + sizes . raw + ' | ' + sizes . minified + ' | ' + sizes . gzipped + ' |' ,
177
208
''
178
209
] . join ( '\n' ) ;
179
210
}
0 commit comments