mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Dependency cleanup
This commit is contained in:
parent
c87a2fd7ec
commit
9520a69c83
@ -16,12 +16,24 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
var createError = require('raptor-util').createError;
|
var createError = require('raptor-util').createError;
|
||||||
var objects = require('raptor-objects');
|
var escapeXmlAttr = require('raptor-util/escapeXml').attr;
|
||||||
var escapeXmlAttr = require('raptor-xml/util').escapeXmlAttr;
|
|
||||||
var XML_URI = 'http://www.w3.org/XML/1998/namespace';
|
var XML_URI = 'http://www.w3.org/XML/1998/namespace';
|
||||||
var XML_URI_ALT = 'http://www.w3.org/XML/1998/namespace';
|
var XML_URI_ALT = 'http://www.w3.org/XML/1998/namespace';
|
||||||
var forEachEntry = require('raptor-util').forEachEntry;
|
var forEachEntry = require('raptor-util').forEachEntry;
|
||||||
|
|
||||||
|
function isEmpty(o) {
|
||||||
|
if (!o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var k in o) {
|
||||||
|
if (o.hasOwnProperty(k)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function ElementNode(localName, namespace, prefix) {
|
function ElementNode(localName, namespace, prefix) {
|
||||||
ElementNode.$super.call(this, 'element');
|
ElementNode.$super.call(this, 'element');
|
||||||
if (!this._elementNode) {
|
if (!this._elementNode) {
|
||||||
@ -132,7 +144,7 @@ ElementNode.prototype = {
|
|||||||
var attrNS = this.attributesByNS[namespace] || (this.attributesByNS[namespace] = {});
|
var attrNS = this.attributesByNS[namespace] || (this.attributesByNS[namespace] = {});
|
||||||
if (attrNS) {
|
if (attrNS) {
|
||||||
delete attrNS[localName];
|
delete attrNS[localName];
|
||||||
if (objects.isEmpty(attrNS)) {
|
if (isEmpty(attrNS)) {
|
||||||
delete this.attributesByNS[namespace];
|
delete this.attributesByNS[namespace];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +165,7 @@ ElementNode.prototype = {
|
|||||||
return preserveSpace;
|
return preserveSpace;
|
||||||
},
|
},
|
||||||
hasAttributesAnyNS: function () {
|
hasAttributesAnyNS: function () {
|
||||||
return !objects.isEmpty(this.attributesByNS);
|
return !isEmpty(this.attributesByNS);
|
||||||
},
|
},
|
||||||
hasAttributes: function () {
|
hasAttributes: function () {
|
||||||
return this.hasAttributesNS('');
|
return this.hasAttributesNS('');
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var createError = require('raptor-util').createError;
|
var createError = require('raptor-util').createError;
|
||||||
var operatorsRegExp = /"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\s+(?:and|or|lt|gt|eq|ne|lt|gt|ge|le)\s+/g;
|
var operatorsRegExp = /"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\s+(?:and|or|lt|gt|eq|ne|lt|gt|ge|le)\s+/g;
|
||||||
var strings = require('raptor-strings');
|
|
||||||
var replacements = {
|
var replacements = {
|
||||||
'and': ' && ',
|
'and': ' && ',
|
||||||
'or': ' || ',
|
'or': ' || ',
|
||||||
@ -29,7 +28,7 @@ var replacements = {
|
|||||||
};
|
};
|
||||||
function handleBinaryOperators(str) {
|
function handleBinaryOperators(str) {
|
||||||
return str.replace(operatorsRegExp, function (match) {
|
return str.replace(operatorsRegExp, function (match) {
|
||||||
return replacements[strings.trim(match)] || match;
|
return replacements[match.trim()] || match;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function Expression(expression, replaceSpecialOperators) {
|
function Expression(expression, replaceSpecialOperators) {
|
||||||
|
|||||||
@ -1,60 +1,88 @@
|
|||||||
var sax = require('raptor-xml/sax');
|
var sax = require("sax");
|
||||||
var createError = require('raptor-util').createError;
|
var extend = require('raptor-util/extend');
|
||||||
|
|
||||||
function ParseTreeBuilderXml(taglibs) {
|
function ParseTreeBuilderXml(taglibs) {
|
||||||
ParseTreeBuilderXml.$super.apply(this, arguments);
|
ParseTreeBuilderXml.$super.apply(this, arguments);
|
||||||
this.parser = null;
|
this.parser = null;
|
||||||
|
this.filePath = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParseTreeBuilderXml.prototype = {
|
ParseTreeBuilderXml.prototype = {
|
||||||
getPos: function() {
|
getPos: function() {
|
||||||
return this.parser.getPos();
|
var parser = this.parser;
|
||||||
|
var filePath = this.filePath;
|
||||||
|
|
||||||
|
var line = parser.line + 1;
|
||||||
|
|
||||||
|
return {
|
||||||
|
line: line,
|
||||||
|
column: parser.column,
|
||||||
|
filePath: filePath,
|
||||||
|
toString: function() {
|
||||||
|
return this.filePath + ":" + this.line + ":" + this.column;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
doParse: function (src, filePath) {
|
doParse: function (src, filePath) {
|
||||||
|
|
||||||
var parser = this.parser = sax.createParser({
|
this.filePath = filePath;
|
||||||
trim: false,
|
var parser = this.parser = sax.parser(true /*strict*/, {
|
||||||
normalize: false,
|
trim: false,
|
||||||
dom: src.documentElement != null
|
normalize: false,
|
||||||
});
|
lowercasetags: false,
|
||||||
|
xmlns: true
|
||||||
|
});
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
|
extend(parser, {
|
||||||
|
onerror: function(e) {
|
||||||
|
throw e;
|
||||||
|
},
|
||||||
|
|
||||||
|
ontext: function(text) {
|
||||||
|
text = text.replace(/\r\n|\r/g, "\n");
|
||||||
|
_this.handleCharacters(text);
|
||||||
|
},
|
||||||
|
|
||||||
parser.on({
|
oncdata: function(text) {
|
||||||
error: function (e) {
|
text = text.replace(/\r\n|\r/g, "\n");
|
||||||
throw createError(e);
|
_this.handleCharacters(text);
|
||||||
},
|
},
|
||||||
characters: function (t) {
|
|
||||||
_this.handleCharacters(t);
|
onopentag: function (node) {
|
||||||
},
|
|
||||||
cdata: function (t) {
|
|
||||||
_this.handleCharacters(t);
|
|
||||||
},
|
|
||||||
startElement: function (elNode) {
|
|
||||||
var el = {
|
var el = {
|
||||||
namespace: elNode.getNamespaceURI(),
|
namespace: node.uri,
|
||||||
prefix: elNode.getPrefix(),
|
prefix: node.prefix,
|
||||||
localName: elNode.getLocalName()
|
localName: node.local
|
||||||
};
|
};
|
||||||
|
|
||||||
var attributes = elNode.getAttributes().map(function (attr) {
|
var attributes = Object.keys(node.attributes).map(function(attrName) {
|
||||||
|
var attr = node.attributes[attrName];
|
||||||
return {
|
return {
|
||||||
namespace: attr.getNamespaceURI(),
|
namespace: attr.uri,
|
||||||
localName: attr.getLocalName(),
|
localName: attr.local,
|
||||||
prefix: attr.getPrefix(),
|
prefix: attr.prefix,
|
||||||
value: attr.getValue()
|
value: attr.value
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
_this.handleStartElement(el, attributes);
|
_this.handleStartElement(el, attributes);
|
||||||
},
|
},
|
||||||
endElement: function () {
|
|
||||||
_this.handleEndElement();
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
parser.parse(src, filePath);
|
|
||||||
|
|
||||||
|
onclosetag: function () {
|
||||||
|
_this.handleEndElement();
|
||||||
|
},
|
||||||
|
|
||||||
|
oncomment: function (comment) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
parser.write(src).close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
var createError = require('raptor-util').createError;
|
var createError = require('raptor-util').createError;
|
||||||
var escapeXml = require('raptor-xml/util').escapeXml;
|
var escapeXml = require('raptor-util/escapeXml');
|
||||||
var EscapeXmlContext = require('./EscapeXmlContext');
|
var EscapeXmlContext = require('./EscapeXmlContext');
|
||||||
|
|
||||||
var attrReplace = /[&<>\"\']/g;
|
var attrReplace = /[&<>\"\']/g;
|
||||||
|
|||||||
118
package.json
118
package.json
@ -1,61 +1,59 @@
|
|||||||
{
|
{
|
||||||
"name": "raptor-templates",
|
"name": "raptor-templates",
|
||||||
"description": "Raptor Templates",
|
"description": "Raptor Templates",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"templating",
|
"templating",
|
||||||
"template",
|
"template",
|
||||||
"async",
|
"async",
|
||||||
"streaming"
|
"streaming"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/raptorjs3/raptor-templates.git"
|
"url": "https://github.com/raptorjs3/raptor-templates.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node_modules/.bin/mocha --ui bdd --reporter spec ./test && node_modules/.bin/jshint compiler/ runtime/ taglibs/ dust/"
|
"test": "node_modules/.bin/mocha --ui bdd --reporter spec ./test && node_modules/.bin/jshint compiler/ runtime/ taglibs/ dust/"
|
||||||
},
|
},
|
||||||
"author": "Patrick Steele-Idem <pnidem@gmail.com>",
|
"author": "Patrick Steele-Idem <pnidem@gmail.com>",
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
"Patrick Steele-Idem <pnidem@gmail.com>"
|
"Patrick Steele-Idem <pnidem@gmail.com>"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"raptor-detect": "^0.2.0-beta",
|
"raptor-detect": "^0.2.0-beta",
|
||||||
"raptor-logging": "^0.2.0-beta",
|
"raptor-logging": "^0.2.0-beta",
|
||||||
"raptor-strings": "^0.2.0-beta",
|
"raptor-strings": "^0.2.0-beta",
|
||||||
"raptor-regexp": "^0.2.0-beta",
|
"raptor-regexp": "^0.2.0-beta",
|
||||||
"raptor-util": "^0.2.0-beta",
|
"raptor-util": "^0.2.0-beta",
|
||||||
"raptor-arrays": "^0.2.0-beta",
|
"raptor-json": "^0.2.0-beta",
|
||||||
"raptor-json": "^0.2.0-beta",
|
"raptor-modules": "^0.2.0-beta",
|
||||||
"raptor-modules": "^0.2.0-beta",
|
"raptor-render-context": "^0.2.0-beta",
|
||||||
"raptor-render-context": "^0.2.0-beta",
|
"raptor-data-providers": "^0.2.0-beta",
|
||||||
"raptor-data-providers": "^0.2.0-beta",
|
"raptor-ecma": "^0.2.0-beta",
|
||||||
"raptor-xml": "^0.2.0-beta",
|
"htmlparser2": "~3.5.1",
|
||||||
"raptor-objects": "^0.2.0-beta",
|
"char-props": "~0.1.5",
|
||||||
"raptor-ecma": "^0.2.0-beta",
|
"raptor-promises": "^0.2.0-beta",
|
||||||
"htmlparser2": "~3.5.1",
|
"raptor-args": "^0.1.9-beta",
|
||||||
"char-props": "~0.1.5",
|
"minimatch": "^0.2.14",
|
||||||
"raptor-promises": "^0.2.0-beta",
|
"property-handlers": "^0.2.1-beta",
|
||||||
"raptor-args": "^0.1.9-beta",
|
"raptor-dust": "^0.3.6-beta",
|
||||||
"minimatch": "^0.2.14",
|
"sax": "^0.6.0"
|
||||||
"property-handlers": "^0.2.1-beta",
|
},
|
||||||
"raptor-dust": "^0.3.6-beta"
|
"devDependencies": {
|
||||||
},
|
"mocha": "~1.15.1",
|
||||||
"devDependencies": {
|
"chai": "~1.8.1",
|
||||||
"mocha": "~1.15.1",
|
"jshint": "^2.5.0",
|
||||||
"chai": "~1.8.1",
|
"raptor-cache": "^0.2.7-beta",
|
||||||
"jshint": "^2.5.0",
|
"dustjs-linkedin": "^2.3.4",
|
||||||
"raptor-cache": "^0.2.7-beta",
|
"through": "^2.3.4"
|
||||||
"dustjs-linkedin": "^2.3.4",
|
},
|
||||||
"through": "^2.3.4"
|
"license": "Apache License v2.0",
|
||||||
},
|
"bin": {
|
||||||
"license": "Apache License v2.0",
|
"rhtmlc": "bin/rhtmlc"
|
||||||
"bin": {
|
},
|
||||||
"rhtmlc": "bin/rhtmlc"
|
"main": "runtime/raptor-templates-runtime.js",
|
||||||
},
|
"publishConfig": {
|
||||||
"main": "runtime/raptor-templates-runtime.js",
|
"registry": "https://registry.npmjs.org/"
|
||||||
"publishConfig": {
|
},
|
||||||
"registry": "https://registry.npmjs.org/"
|
"ebay": {},
|
||||||
},
|
"version": "0.2.38-beta"
|
||||||
"ebay": {},
|
}
|
||||||
"version": "1.0.0"
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user