update saxparser and jshint
This commit is contained in:
parent
207adf8eba
commit
8d45a2d209
3 changed files with 10085 additions and 10585 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,12 @@ var deps = {
|
||||||
csslint: {
|
csslint: {
|
||||||
path: "mode/css/csslint.js",
|
path: "mode/css/csslint.js",
|
||||||
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint.js",
|
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint.js",
|
||||||
needsFixup: true
|
needsFixup: true,
|
||||||
|
browserify: {
|
||||||
|
npmModule: "csslint@latest",
|
||||||
|
path: "jshint/src/jshint.js",
|
||||||
|
exports: "jshint"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
requirejs: {
|
requirejs: {
|
||||||
path: "../../demo/kitchen-sink/require.js",
|
path: "../../demo/kitchen-sink/require.js",
|
||||||
|
|
@ -30,49 +35,34 @@ var deps = {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jshint: {
|
html5: {
|
||||||
path: "mode/javascript/jshint.js",
|
path: "mode/html/saxparser.js",
|
||||||
url: "http://jshint.com/get/jshint-2.1.9.js",
|
browserify: {
|
||||||
fetch: function(_, cb) {
|
npmModule: "git+https://github.com/aredridel/html5.git#master",
|
||||||
//run("npm install jshint@latest", function() {
|
path: "html5/lib/sax/SAXParser.js",
|
||||||
var base = Path.join(__dirname, "/node_modules/jshint/")
|
exports: "SAXParser"
|
||||||
var path = Path.join(base, "/src/stable/jshint")
|
|
||||||
run('browserify ' + path + ' -i console-browserify -r jshint', function(err, src) {
|
|
||||||
src = replaceConsoleBrowserify(src);
|
|
||||||
var version = JSON.parse(fs.readFileSync(base + "package.json")).version
|
|
||||||
src = [ "// " + version,
|
|
||||||
"var JSHINT;",
|
|
||||||
"(function () {",
|
|
||||||
"require = null;",
|
|
||||||
src,
|
|
||||||
"JSHINT = require('jshint').JSHINT;",
|
|
||||||
"}());"
|
|
||||||
].join("\n")
|
|
||||||
cb(err, src);
|
|
||||||
})
|
|
||||||
//});
|
|
||||||
},
|
},
|
||||||
|
fetch: browserify,
|
||||||
|
needsFixup: true,
|
||||||
|
postProcess: function(src) {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jshint: {
|
||||||
|
path: "mode/javascript/jshint.js",
|
||||||
|
browserify: {
|
||||||
|
npmModule: "git+https://github.com/nightwing/jshint.git#master",
|
||||||
|
path: "jshint/src/jshint.js",
|
||||||
|
exports: "jshint"
|
||||||
|
},
|
||||||
|
fetch: browserify,
|
||||||
needsFixup: true,
|
needsFixup: true,
|
||||||
postProcess: function(src) {
|
postProcess: function(src) {
|
||||||
src = src.replace(/(\],|\{)((?:\d+|"\w+"):\[)/g, "$1\n$2")
|
|
||||||
.replace(/^(\},)(\{[^{}\[\]]*?\}\])/gm, "$1\n$2")
|
|
||||||
|
|
||||||
src = src.replace(
|
src = src.replace(
|
||||||
/"Expected a conditional expression and instead saw an assignment."/g,
|
/"Expected a conditional expression and instead saw an assignment."/g,
|
||||||
'"Assignment in conditional expression"'
|
'"Assignment in conditional expression"'
|
||||||
);
|
);
|
||||||
|
|
||||||
src = src.replace(/\brequire\(["']|\(require,|\(require\)/g, function(r){
|
|
||||||
return r.replace("require", "req");
|
|
||||||
})
|
|
||||||
|
|
||||||
src = src.replace(/var defaultMaxListeners = 10;/, function(a) {return a.replace("10", "200")});
|
src = src.replace(/var defaultMaxListeners = 10;/, function(a) {return a.replace("10", "200")});
|
||||||
|
|
||||||
src = src.replace(/var JSHINT;\s*\(function[\s()]+\{\s*/, "")
|
|
||||||
.replace(/JSHINT = .*\n\s*\}\(\)\);\s*/, "");
|
|
||||||
src += '\n'
|
|
||||||
+ 'function req() {return require.apply(this, arguments)}\n'
|
|
||||||
+ 'module.exports = req("jshint");\n';
|
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -238,23 +228,19 @@ function unquote(str) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceConsoleBrowserify(str) {
|
function browserify(_, cb) {
|
||||||
var simpleConsole = function(req,module,exports){
|
var br = this.browserify;
|
||||||
["log", "info", "warn", "error",
|
var path = Path.join("node_modules", br.path)
|
||||||
"time","timeEnd", "trace", "dir", "assert"
|
run("npm install " + this.browserify.npmModule, function() {
|
||||||
].forEach(function(x) {exports[x] = nop;});
|
run("browserify " + path + " -s " + br.exports, function(err, src) {
|
||||||
function nop() {}
|
src = src.replace(/^.*return\s*\(function/, "module.exports = (function")
|
||||||
}
|
.replace(/\}\);\s*$/, "");
|
||||||
var m = /"console-browserify":(\d+)/.exec(str);
|
src = src.replace(/(\],|\{)((?:\d+|"\w+"):\[)/g, "$1\n$2")
|
||||||
name = m && m[1];
|
.replace(/^(\},)(\{[^{}\[\]]*?\}\])/gm, "$1\n$2")
|
||||||
if (name) {
|
cb(err, src);
|
||||||
str = str.replace(
|
})
|
||||||
"{1:[",
|
})
|
||||||
"{" + name + ":[" + simpleConsole + ",{}],\n1:["
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDep(deps.html5)
|
||||||
getDep(deps.jshint)
|
getDep(deps.jshint)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue