*/
+// For "production" code, this gets set to false by uglifyjs.
+if (typeof(DEBUG) === 'undefined') DEBUG=true;
+
/*jshint globalstrict: true */
/*global DygraphLayout:false, DygraphCanvasRenderer:false, DygraphOptions:false, G_vmlCanvasManager:false,ActiveXObject:false */
"use strict";
* @return { ... } The value of the option.
*/
Dygraph.prototype.attr_ = function(name, seriesName) {
-// <REMOVE_FOR_COMBINED>
- if (typeof(Dygraph.OPTIONS_REFERENCE) === 'undefined') {
- console.error('Must include options reference JS for testing');
- } else if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(name)) {
- console.error('Dygraphs is using property ' + name + ', which has no ' +
- 'entry in the Dygraphs.OPTIONS_REFERENCE listing.');
- // Only log this error once.
- Dygraph.OPTIONS_REFERENCE[name] = true;
- }
-// </REMOVE_FOR_COMBINED>
+ if (DEBUG) {
+ if (typeof(Dygraph.OPTIONS_REFERENCE) === 'undefined') {
+ console.error('Must include options reference JS for testing');
+ } else if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(name)) {
+ console.error('Dygraphs is using property ' + name + ', which has no ' +
+ 'entry in the Dygraphs.OPTIONS_REFERENCE listing.');
+ // Only log this error once.
+ Dygraph.OPTIONS_REFERENCE[name] = true;
+ }
+ }
return seriesName ? this.attributes_.getForSeries(name, seriesName) : this.attributes_.get(name);
};
+++ /dev/null
-#!/bin/bash
-
-# Reports compressed file sizes for each JS file in dygraphs.
-
-# This list needs to be kept in sync w/ the one in dygraph-dev.js
-# and the one in jsTestDriver.conf.
-for file in \
-dygraph-layout.js \
-dygraph-canvas.js \
-dygraph.js \
-dygraph-utils.js \
-dygraph-gviz.js \
-dygraph-interaction-model.js \
-dygraph-tickers.js \
-dashed-canvas.js \
-dygraph-plugin-base.js \
-plugins/annotations.js \
-plugins/axes.js \
-plugins/range-selector.js \
-plugins/chart-labels.js \
-plugins/grid.js \
-plugins/legend.js \
-dygraph-plugin-install.js \
-; do
- base_size=$(cat $file | wc -c)
- cat $file \
- | perl -ne 'print unless m,REMOVE_FOR_COMBINED,..m,/REMOVE_FOR_COMBINED,' \
- > /tmp/dygraph.js
- min_size=$(java -jar yuicompressor-2.4.2.jar /tmp/dygraph.js | gzip -c | wc -c)
-
- echo "$min_size ($base_size) $file"
-done
# Pack all the JS together.
CatSources () {
GetSources \
- | xargs cat \
- | perl -ne 'print unless m,REMOVE_FOR_COMBINED,..m,/REMOVE_FOR_COMBINED,'
+ | xargs cat
}
Copyright () {
}
CatCompressed () {
- Copyright
- CatSources \
- | grep -v '"use strict";' \
- | node_modules/uglify-js/bin/uglifyjs -c warnings=false -m
+ node_modules/uglify-js/bin/uglifyjs \
+ $(GetSources | xargs) \
+ --compress warnings=false \
+ --mangle \
+ --define DEBUG=false \
+ --preamble "$(Copyright)" \
+ $*
}
ACTION="${1:-update}"
CatCompressed
;;
update)
- CatCompressed > dygraph-combined.js
- chmod a+r dygraph-combined.js
+ CatCompressed --source-map dygraph-combined.js.map \
+ > dygraph-combined.js
+ chmod a+r dygraph-combined.js dygraph-combined.js.map
;;
*)
echo >&2 "Unknown action '$ACTION'"