Compare commits

...

4 Commits

Author SHA1 Message Date
Francisco López
f2e49864d9 Merge pull request #33 from CartoDB/SMOKES-reference-errors
Smokes reference errors
2017-05-19 09:32:19 +02:00
Francisco López
813446edd2 Merge branch 'tangram-release' into SMOKES-reference-errors 2017-05-19 09:31:46 +02:00
Francisco López
d2fce406c9 Release carto strict mode 2017-05-19 09:27:27 +02:00
Francisco López
81c87d044f Dist files for tangram 2017-04-17 15:27:05 +02:00
2 changed files with 127 additions and 84 deletions

8
dist/carto.js vendored

File diff suppressed because one or more lines are too long

View File

@ -331,7 +331,7 @@ function stylize(str, style) {
} }
}).call(this,require('_process'),"/lib/carto") }).call(this,require('_process'),"/lib/carto")
},{"../../package.json":44,"./functions":1,"./parser":3,"./renderer":4,"./renderer_js":5,"./torque-reference":6,"./tree":7,"./tree/call":8,"./tree/color":9,"./tree/comment":10,"./tree/definition":11,"./tree/dimension":12,"./tree/element":13,"./tree/expression":14,"./tree/field":15,"./tree/filter":16,"./tree/filterset":17,"./tree/fontset":18,"./tree/frame_offset":19,"./tree/imagefilter":20,"./tree/invalid":21,"./tree/keyword":22,"./tree/layer":23,"./tree/literal":24,"./tree/operation":25,"./tree/quoted":26,"./tree/reference":27,"./tree/rule":28,"./tree/ruleset":29,"./tree/selector":30,"./tree/style":31,"./tree/url":32,"./tree/value":33,"./tree/variable":34,"./tree/zoom":35,"_process":40,"fs":36,"path":39,"util":42}],3:[function(require,module,exports){ },{"../../package.json":44,"./functions":1,"./parser":3,"./renderer":4,"./renderer_js":5,"./torque-reference":6,"./tree":7,"./tree/call":8,"./tree/color":9,"./tree/comment":10,"./tree/definition":11,"./tree/dimension":12,"./tree/element":13,"./tree/expression":14,"./tree/field":15,"./tree/filter":16,"./tree/filterset":17,"./tree/fontset":18,"./tree/frame_offset":19,"./tree/imagefilter":20,"./tree/invalid":21,"./tree/keyword":22,"./tree/layer":23,"./tree/literal":24,"./tree/operation":25,"./tree/quoted":26,"./tree/reference":27,"./tree/rule":28,"./tree/ruleset":29,"./tree/selector":30,"./tree/style":31,"./tree/url":32,"./tree/value":33,"./tree/variable":34,"./tree/zoom":35,"_process":40,"fs":37,"path":39,"util":43}],3:[function(require,module,exports){
(function (global){ (function (global){
var carto = exports, var carto = exports,
tree = require('./tree'), tree = require('./tree'),
@ -812,6 +812,7 @@ carto.Parser = function Parser(env) {
return new tree.Dimension(value[1], value[2], memo); return new tree.Dimension(value[1], value[2], memo);
} }
} }
}, },
// The variable part of a variable definition. // The variable part of a variable definition.
@ -1060,10 +1061,22 @@ carto.Parser = function Parser(env) {
}, },
// A sub-expression, contained by parenthensis // A sub-expression, contained by parenthensis
sub: function() { sub: function() {
var e; var e, expressions = [];
if ($('(') && (e = $(this.expression)) && $(')')) { if ($('(')) {
return e; while (e = $(this.expression)) {
expressions.push(e);
if (! $(',')) { break; }
}
$(')');
}
if (expressions.length > 1) {
return new tree.Value(expressions.map(function(e) {
return e.value[0];
}));
} else if (expressions.length === 1) {
return new tree.Value(expressions);
} }
}, },
// This is a misnomer because it actually handles multiplication // This is a misnomer because it actually handles multiplication
@ -1729,12 +1742,15 @@ CartoCSS.prototype = {
var layer = layers[key] = (layers[key] || { var layer = layers[key] = (layers[key] || {
symbolizers: [] symbolizers: []
}); });
for(var u = 0; u<def.rules.length; u++){ for(var u = 0; u<def.rules.length; u++){
if(def.rules[u].name === "marker-file" || def.rules[u].name === "point-file"){ var rule = def.rules[u];
var value = def.rules[u].value.value[0].value[0].value.value; if(rule.name === "marker-file" || rule.name === "point-file"){
var value = rule.value.value[0].value[0].value.value;
this.imageURLs.push(value); this.imageURLs.push(value);
} }
} }
layer.frames = []; layer.frames = [];
layer.zoom = tree.Zoom.all; layer.zoom = tree.Zoom.all;
var props = def.toJS(parse_env); var props = def.toJS(parse_env);
@ -1762,6 +1778,14 @@ CartoCSS.prototype = {
var done = {}; var done = {};
for(var i = 0; i < defs.length; ++i) { for(var i = 0; i < defs.length; ++i) {
var def = defs[i]; var def = defs[i];
if (this.options.strict) {
def.toXML(parse_env, {});
if (parse_env.errors.message) {
throw new Error(parse_env.errors.message);
}
}
var k = defKey(def); var k = defKey(def);
var layer = layers[k]; var layer = layers[k];
if(!done[k]) { if(!done[k]) {
@ -1798,12 +1822,13 @@ CartoCSS.prototype = {
carto.RendererJS = function (options) { carto.RendererJS = function (options) {
this.options = options || {}; this.options = options || {};
this.options.mapnik_version = this.options.mapnik_version || 'latest'; this.options.mapnik_version = this.options.mapnik_version || 'latest';
this.reference = this.options.reference || require('./torque-reference').version.latest;
this.options.strict = this.options.hasOwnProperty('strict') ? this.options.strict : false;
}; };
// Prepare a javascript object which contains the layers // Prepare a javascript object which contains the layers
carto.RendererJS.prototype.render = function render(cartocss, callback) { carto.RendererJS.prototype.render = function render(cartocss, callback) {
var reference = require('./torque-reference'); tree.Reference.setData(this.reference);
tree.Reference.setData(reference.version.latest);
return new CartoCSS(cartocss, this.options); return new CartoCSS(cartocss, this.options);
} }
@ -1984,7 +2009,17 @@ var _mapnik_reference_latest = {
["sharpen", 0], ["sharpen", 0],
["colorize-alpha", -1], ["colorize-alpha", -1],
["color-to-alpha", 1], ["color-to-alpha", 1],
["scale-hsla", 8] ["scale-hsla", 8],
["buckets", -1],
["category", -1],
["equal", -1],
["headtails", -1],
["jenks", -1],
["quantiles", -1],
["cartocolor", -1],
["colorbrewer", -1],
["range", -1],
["ramp", -1]
], ],
"doc": "A list of image filters." "doc": "A list of image filters."
}, },
@ -2111,14 +2146,16 @@ var _mapnik_reference_latest = {
"type": "color", "type": "color",
"default-value": "rgba(128,128,128,1)", "default-value": "rgba(128,128,128,1)",
"default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)", "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
"doc": "Fill color to assign to a polygon" "doc": "Fill color to assign to a polygon",
"expression": true
}, },
"fill-opacity": { "fill-opacity": {
"css": "polygon-opacity", "css": "polygon-opacity",
"type": "float", "type": "float",
"doc": "The opacity of the polygon", "doc": "The opacity of the polygon",
"default-value": 1, "default-value": 1,
"default-meaning": "opaque" "default-meaning": "opaque",
"expression": true
}, },
"gamma": { "gamma": {
"css": "polygon-gamma", "css": "polygon-gamma",
@ -2219,13 +2256,15 @@ var _mapnik_reference_latest = {
"default-value": "rgba(0,0,0,1)", "default-value": "rgba(0,0,0,1)",
"type": "color", "type": "color",
"default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)", "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
"doc": "The color of a drawn line" "doc": "The color of a drawn line",
"expression": true
}, },
"stroke-width": { "stroke-width": {
"css": "line-width", "css": "line-width",
"default-value": 1, "default-value": 1,
"type": "float", "type": "float",
"doc": "The width of a line in pixels" "doc": "The width of a line in pixels",
"expression": true
}, },
"stroke-opacity": { "stroke-opacity": {
"css": "line-opacity", "css": "line-opacity",
@ -2390,7 +2429,8 @@ var _mapnik_reference_latest = {
"doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.", "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
"default-value": "", "default-value": "",
"default-meaning": "An ellipse or circle, if width equals height", "default-meaning": "An ellipse or circle, if width equals height",
"type": "uri" "type": "uri",
"expression": true
}, },
"opacity": { "opacity": {
"css": "marker-opacity", "css": "marker-opacity",
@ -2474,7 +2514,8 @@ var _mapnik_reference_latest = {
"css": "marker-fill", "css": "marker-fill",
"default-value": "blue", "default-value": "blue",
"doc": "The color of the area of the marker.", "doc": "The color of the area of the marker.",
"type": "color" "type": "color",
"expression": true
}, },
"allow-overlap": { "allow-overlap": {
"css": "marker-allow-overlap", "css": "marker-allow-overlap",
@ -2849,7 +2890,8 @@ var _mapnik_reference_latest = {
"type": "uri", "type": "uri",
"default-value": "none", "default-value": "none",
"required": true, "required": true,
"doc": "An image file to be repeated and warped along a line" "doc": "An image file to be repeated and warped along a line",
"expression": true
}, },
"clip": { "clip": {
"css": "line-pattern-clip", "css": "line-pattern-clip",
@ -2929,7 +2971,8 @@ var _mapnik_reference_latest = {
"type": "uri", "type": "uri",
"default-value": "none", "default-value": "none",
"required": true, "required": true,
"doc": "Image to use as a repeated pattern fill within a polygon" "doc": "Image to use as a repeated pattern fill within a polygon",
"expression": true
}, },
"alignment": { "alignment": {
"css": "polygon-pattern-alignment", "css": "polygon-pattern-alignment",
@ -4235,7 +4278,7 @@ tree.Definition.prototype.toJS = function(env) {
})(require('../tree')); })(require('../tree'));
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../tree":7,"assert":37,"underscore":undefined}],12:[function(require,module,exports){ },{"../tree":7,"assert":36,"underscore":undefined}],12:[function(require,module,exports){
(function (global){ (function (global){
(function(tree) { (function(tree) {
var _ = global._ || require('underscore'); var _ = global._ || require('underscore');
@ -5302,7 +5345,7 @@ tree.Reference = ref;
})(require('../tree')); })(require('../tree'));
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../tree":7,"mapnik-reference":43,"underscore":undefined}],28:[function(require,module,exports){ },{"../tree":7,"mapnik-reference":38,"underscore":undefined}],28:[function(require,module,exports){
(function(tree) { (function(tree) {
// a rule is a single property and value combination, or variable // a rule is a single property and value combination, or variable
// name and value combination, like // name and value combination, like
@ -5941,8 +5984,6 @@ tree.Zoom.prototype.toString = function() {
}; };
},{"../tree":7}],36:[function(require,module,exports){ },{"../tree":7}],36:[function(require,module,exports){
},{}],37:[function(require,module,exports){
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
// //
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
@ -6304,32 +6345,38 @@ var objectKeys = Object.keys || function (obj) {
return keys; return keys;
}; };
},{"util/":42}],38:[function(require,module,exports){ },{"util/":43}],37:[function(require,module,exports){
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module },{}],38:[function(require,module,exports){
module.exports = function inherits(ctor, superCtor) { (function (__dirname){
ctor.super_ = superCtor var fs = require('fs'),
ctor.prototype = Object.create(superCtor.prototype, { path = require('path'),
constructor: { existsSync = require('fs').existsSync || require('path').existsSync;
value: ctor,
enumerable: false, // Load all stated versions into the module exports
writable: true, module.exports.version = {};
configurable: true
var refs = [
'2.0.0',
'2.0.1',
'2.0.2',
'2.1.0',
'2.1.1',
'2.2.0',
'2.3.0',
'3.0.0'
];
refs.map(function(version) {
module.exports.version[version] = require(path.join(__dirname, version, 'reference.json'));
var ds_path = path.join(__dirname, version, 'datasources.json');
if (existsSync(ds_path)) {
module.exports.version[version].datasources = require(ds_path).datasources;
} }
}); });
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
},{}],39:[function(require,module,exports){ }).call(this,"/node_modules/mapnik-reference")
},{"fs":37,"path":39}],39:[function(require,module,exports){
(function (process){ (function (process){
// Copyright Joyent, Inc. and other Node contributors. // Copyright Joyent, Inc. and other Node contributors.
// //
@ -6646,13 +6693,38 @@ process.chdir = function (dir) {
}; };
},{}],41:[function(require,module,exports){ },{}],41:[function(require,module,exports){
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
},{}],42:[function(require,module,exports){
module.exports = function isBuffer(arg) { module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object' return arg && typeof arg === 'object'
&& typeof arg.copy === 'function' && typeof arg.copy === 'function'
&& typeof arg.fill === 'function' && typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function'; && typeof arg.readUInt8 === 'function';
} }
},{}],42:[function(require,module,exports){ },{}],43:[function(require,module,exports){
(function (process,global){ (function (process,global){
// Copyright Joyent, Inc. and other Node contributors. // Copyright Joyent, Inc. and other Node contributors.
// //
@ -7242,36 +7314,7 @@ function hasOwnProperty(obj, prop) {
} }
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./support/isBuffer":41,"_process":40,"inherits":38}],43:[function(require,module,exports){ },{"./support/isBuffer":42,"_process":40,"inherits":41}],44:[function(require,module,exports){
(function (__dirname){
var fs = require('fs'),
path = require('path'),
existsSync = require('fs').existsSync || require('path').existsSync;
// Load all stated versions into the module exports
module.exports.version = {};
var refs = [
'2.0.0',
'2.0.1',
'2.0.2',
'2.1.0',
'2.1.1',
'2.2.0',
'2.3.0',
'3.0.0'
];
refs.map(function(version) {
module.exports.version[version] = require(path.join(__dirname, version, 'reference.json'));
var ds_path = path.join(__dirname, version, 'datasources.json');
if (existsSync(ds_path)) {
module.exports.version[version].datasources = require(ds_path).datasources;
}
});
}).call(this,"/node_modules/mapnik-reference")
},{"fs":36,"path":39}],44:[function(require,module,exports){
module.exports={ module.exports={
"name": "carto", "name": "carto",
"version": "0.15.1-cdb1", "version": "0.15.1-cdb1",