includejs
Advanced tools
Comparing version 0.6.3 to 0.6.4
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"bin": { | ||
@@ -12,0 +12,0 @@ "includejs": "includejs" |
@@ -11,3 +11,4 @@ | ||
'solution.js', | ||
'custom.js']).done( | ||
'custom.js', | ||
'concat.js']).done( | ||
@@ -26,3 +27,3 @@ function(resp) { | ||
Construct: function(idfr) { | ||
this.idfr = idfr; | ||
this.idfr = idfr; | ||
this.process = this.process.bind(this); | ||
@@ -38,7 +39,7 @@ }, | ||
} | ||
global.config = current; | ||
var handler; | ||
switch(current.action){ | ||
@@ -56,5 +57,5 @@ case 'build': | ||
handler = resp[current.action]; | ||
break; | ||
break; | ||
} | ||
if (handler == null){ | ||
@@ -64,6 +65,6 @@ console.error('Error: Unknown Handler', current.action); | ||
} | ||
handler.process(current, { | ||
resolve: this.process | ||
}); | ||
}); | ||
} | ||
@@ -76,2 +77,2 @@ }); | ||
}); | ||
}); |
@@ -10,6 +10,8 @@ | ||
if (indent != null){ | ||
currentIndent = indent; | ||
} | ||
currentIndent = indent; | ||
} | ||
var _ = ''; | ||
if (currentIndent) for (var i = 0; i < currentIndent; i++) _ += ' '; | ||
if (currentIndent) { | ||
for (var i = 0; i < currentIndent; i++) _ += ' '; | ||
} | ||
console.log(_ + message); | ||
@@ -57,3 +59,3 @@ } | ||
write('Further options at http://libjs.it/#/includeBuilder/commands') | ||
}); | ||
@@ -60,0 +62,0 @@ |
@@ -164,6 +164,11 @@ include.js({ | ||
var _filesCount = null; | ||
include.exports = { | ||
ofType: function(type, solution) { | ||
var stack = includesStack.resolve(type, solution.resource.includes); | ||
if (!stack.length) { | ||
var stack = includesStack.resolve(type, solution.resource.includes), | ||
length = stack.length; | ||
_filesCount[type] = length; | ||
if (length == 0) { | ||
return; | ||
@@ -175,2 +180,3 @@ } | ||
BuilderHelper[type](solution, stack, solution.output); | ||
@@ -180,2 +186,3 @@ }, | ||
build: function(solution, idfr) { | ||
_filesCount = {}; | ||
solution.output = {}; | ||
@@ -190,3 +197,3 @@ solution.bin = {}; | ||
if (solution.output.js) { | ||
if (solution.output.js) { | ||
new io.File(solution.uris.outputDirectory.combine('script.js')).write(solution.output.js); | ||
@@ -199,2 +206,7 @@ } | ||
console.log( // | ||
color( // | ||
String.format( // | ||
'bold{green{Files: [JS: #{js.length}] [CSS: #{css.length}] [LOAD: #{load.length}] [LAZY: #{lazy.length}]}}', _filesCount))); | ||
resp.HtmlBuilder.build(solution, solution.output); | ||
@@ -204,2 +216,5 @@ | ||
idfr.resolve && idfr.resolve(); | ||
@@ -206,0 +221,0 @@ } |
@@ -31,3 +31,3 @@ | ||
} | ||
})() | ||
}()) | ||
}; | ||
@@ -37,2 +37,3 @@ | ||
}()); |
@@ -114,2 +114,4 @@ (function(g) { | ||
Log && Log('io.utils:file.save', path, 99); | ||
try { | ||
@@ -158,2 +160,4 @@ fs.writeFileSync(path, content); | ||
readSync: function(file, asBuffer) { | ||
Log && Log('io.utils:file.read', file, 99); | ||
var content = ''; | ||
@@ -160,0 +164,0 @@ try { |
(function() { | ||
include.exports = function(file){ | ||
var coffee = require('coffee-script'); | ||
file.content = coffee.compile(file.content); | ||
if (typeof file.content !== 'string'){ | ||
file.content = file.content.toString(); | ||
} | ||
file.content = coffee.compile(file.content); | ||
} | ||
}()); | ||
}()); |
@@ -20,5 +20,16 @@ (function() { | ||
include.exports = function(file) { | ||
var code = file.content, | ||
defines; | ||
file.content = process(file.content, 0, global.config.defines || {}); | ||
if (defines == null){ | ||
return; | ||
} | ||
if (typeof code !== 'string'){ | ||
code = code.toString(); | ||
} | ||
file.content = process(code, 0, defines); | ||
}; | ||
@@ -25,0 +36,0 @@ |
@@ -16,8 +16,8 @@ include.js({ | ||
var config = global.config.jshint; | ||
if (!config){ | ||
return; | ||
} | ||
var globals = config.globals, | ||
@@ -44,4 +44,6 @@ options = config.options, | ||
if (typeof file.content !== 'string'){ | ||
file.content = file.content.toString(); | ||
} | ||
var start = Date.now(), | ||
@@ -51,3 +53,6 @@ result = jshint(file.content, options, globals); | ||
console.log('JSHINT...[%sms] %s', Date.now() - start, file.uri.file, result ? color('green{Success}') : color('red{' + jshint.errors.length + '}')); | ||
console.log( // | ||
color(String.format( // | ||
'%1 [%2ms] %3', result ? 'green{Success}' : 'red{Warn ' + jshint.errors.length + '}', Date.now() - start, file.uri.file // | ||
))); | ||
@@ -75,2 +80,2 @@ if (!result) { | ||
}; | ||
}); | ||
}); |
@@ -12,2 +12,6 @@ (function() { | ||
if (typeof file.content !== 'string'){ | ||
file.content = file.content.toString(); | ||
} | ||
parser.parse(file.content, function(error, tree) { | ||
@@ -24,4 +28,4 @@ if (error) { | ||
}); | ||
} | ||
}()); | ||
}()); |
var __eval = function(source, include) { | ||
"use strict"; | ||
var iparams = include && include.route.params; | ||
try { | ||
@@ -12,5 +12,5 @@ return eval(source); | ||
//Helper.reportError(error); | ||
console.error(error); | ||
console.error(error.toString()); | ||
} | ||
}; | ||
@@ -21,6 +21,6 @@ | ||
"use strict"; | ||
/** | ||
@@ -39,3 +39,3 @@ * .cfg | ||
eval: document == null | ||
}, | ||
}, | ||
handler = {}, | ||
@@ -45,3 +45,3 @@ hasOwnProp = {}.hasOwnProperty, | ||
XMLHttpRequest = global.XMLHttpRequest; | ||
var Helper = { /** TODO: improve url handling*/ | ||
@@ -68,4 +68,4 @@ uri: { | ||
} | ||
if (url[0] === '/') { | ||
@@ -78,4 +78,4 @@ if (isWeb === false || cfg.lockedToFolder === true) { | ||
} | ||
while(url.indexOf('../') > -1){ | ||
@@ -165,4 +165,4 @@ url = url.replace(/[^\/]+\/\.\.\//,''); | ||
alias, path, params, route, i, x, length; | ||
if (~aliasIndex){ | ||
@@ -172,3 +172,3 @@ alias = template.substring(aliasIndex + 2); | ||
} | ||
if (~questionMark) { | ||
@@ -188,3 +188,3 @@ var arr = template.substring(questionMark + 1).split('&'); | ||
route = routes[namespace]; | ||
if (route == null){ | ||
@@ -197,5 +197,5 @@ return { | ||
} | ||
path = route[0]; | ||
for (i = 1; i < route.length; i++) { | ||
@@ -207,3 +207,3 @@ if (i % 2 === 0) { | ||
* take always the last one for failed peaces */ | ||
var index = route[i] << 0; | ||
@@ -213,7 +213,7 @@ if (index > template.length - 1) { | ||
} | ||
path += template[index]; | ||
if (i == route.length - 2){ | ||
@@ -281,4 +281,4 @@ for(index++;index < template.length; index++){ | ||
namespace += '.' + includeData; | ||
} | ||
} | ||
fn(namespace, x, xpath); | ||
@@ -294,11 +294,11 @@ return; | ||
}, | ||
parseAlias: function(route){ | ||
var path = route.path, | ||
result = regexpAlias.exec(path); | ||
return result && result[1]; | ||
return result && result[1]; | ||
} | ||
}; | ||
}; | ||
@@ -344,4 +344,4 @@ | ||
readycollection = null; | ||
if (document.readyState == 'complete') { | ||
@@ -436,2 +436,3 @@ Events.load = Helper.doNothing; | ||
console.error(error.toString(), 'file:', this.url); | ||
console.trace(); | ||
} | ||
@@ -806,3 +807,3 @@ | ||
//console.log('evaling', resource.url, stack.length); | ||
//console.log('evaling', resource.url, stack.length); | ||
__eval(resource.source, resource); | ||
@@ -929,3 +930,3 @@ | ||
var loader = createLoader(resource.url); | ||
loader.done(function() { | ||
loader.done(function() { | ||
XHR(resource, function(resource, response) { | ||
@@ -1161,3 +1162,3 @@ callback(resource, loader.exports.process(response, resource)); | ||
var fs = require('fs'); | ||
XMLHttpRequest = function(){}; | ||
@@ -1169,7 +1170,7 @@ XMLHttpRequest.prototype = { | ||
send: function(){ | ||
if (this.url.indexOf('file:///') > -1){ | ||
this.url = this.url.replace('file:///',''); | ||
} | ||
var that = this; | ||
@@ -1179,3 +1180,3 @@ fs.readFile(this.url, 'utf-8', function(err, data){ | ||
console.error('>>', err.code, err.path); | ||
data = ''; | ||
data = ''; | ||
} | ||
@@ -1185,3 +1186,3 @@ | ||
that.responseText = data; | ||
that.onreadystatechange(); | ||
that.onreadystatechange(); | ||
}); | ||
@@ -1192,2 +1193,2 @@ } | ||
})(typeof window === 'undefined' ? global : window, typeof document == 'undefined' ? null : document); | ||
})(typeof window === 'undefined' ? global : window, typeof document == 'undefined' ? null : document); |
@@ -29,3 +29,3 @@ void | ||
output += obj[str.substring(index + 2, end)]; | ||
output += Object.getProperty(obj,str.substring(index + 2, end)); | ||
lastIndex = ++end; | ||
@@ -116,2 +116,2 @@ } | ||
}(); | ||
}(); |
@@ -18,3 +18,4 @@ /** | ||
'project-reference', | ||
'custom'], | ||
'custom', | ||
'concat'], | ||
program = require('commander'), | ||
@@ -21,0 +22,0 @@ args = program.args, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
539449
119
9708