includejs
Advanced tools
Comparing version 0.5.5 to 0.5.6
{ | ||
"projects":{ | ||
"libjs" : { | ||
"path": "file:///c:/Development/libjs/" | ||
"path": "file:///d:/libjs/" | ||
} | ||
@@ -6,0 +6,0 @@ }, |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"bin": { | ||
@@ -24,3 +24,4 @@ "includejs": "includejs" | ||
"coffee-script": "~1.4.0", | ||
"less": "~1.3.3" | ||
"less": "~1.3.3", | ||
"openurl": "~1.1.0" | ||
}, | ||
@@ -27,0 +28,0 @@ "repository": { |
@@ -6,2 +6,6 @@ include.exports = { | ||
if (config.args && !script){ | ||
script = config.args[0]; | ||
} | ||
if (!(script && new io.File(script).exists())){ | ||
@@ -8,0 +12,0 @@ console.error('Custom script not exists', script); |
@@ -8,7 +8,27 @@ (function() { | ||
helper: 'referenceHelper::refHelper' | ||
}).done(function(resp) { | ||
}) | ||
.load('/globals.txt') | ||
.done(function(resp) { | ||
var args = require('commander').args, | ||
path = config.path || args[1], | ||
name = config.name || args[2]; | ||
name = config.name || args[2], | ||
projects; | ||
if (!resp.load.globals){ | ||
console.error('Globals.txt is not in includejs root'); | ||
idfr.resolve && idfr.resolve(1); | ||
} | ||
try { | ||
projects = JSON.parse(resp.load.globals).projects; | ||
}catch(error){ | ||
console.error('Globals.txt, in includejs root, contains no valid json data, or contains no projects property'); | ||
idfr.resolve && idfr.resolve(1); | ||
return; | ||
} | ||
if (projects.hasOwnProperty(path)){ | ||
path = projects[path].path; | ||
} | ||
if (!path || new io.Directory(path).exists() == false) { | ||
@@ -15,0 +35,0 @@ |
(function(){ | ||
/** | ||
* CONFIG | ||
* | ||
* action: 'server', | ||
* open: 'url path to open in browser after server has started', is DEFAULT for next raw argument | ||
* port: PORT to start at localhost | ||
*/ | ||
include.exports = { | ||
process: function(config, idfr){ | ||
if (config.args){ | ||
config.open = config.args[0]; | ||
} | ||
include.js('/src/server/server.js').done(function(resp){ | ||
@@ -9,2 +23,6 @@ | ||
if (config.open){ | ||
require('openurl').open(String.format('http://localhost:%1/%2', config.port || 5777, config.open)); | ||
} | ||
idfr && idfr.resolve(); | ||
@@ -11,0 +29,0 @@ }); |
@@ -14,3 +14,7 @@ ! | ||
console.log('Uglify... [start]'); | ||
var config = global.config.uglify, | ||
var config = global.config.uglify || { | ||
global_defs: { | ||
DEBUG: false | ||
} | ||
}, | ||
start = Date.now(), | ||
@@ -17,0 +21,0 @@ compressor, ast; |
@@ -27,5 +27,5 @@ | ||
}, | ||
parseProtocol: function(o){ | ||
parseProtocol: function(o){ | ||
var value = /^([a-zA-Z]+):\/(\/)?/.exec(o.value); // @ 'c:/file.txt'| 'protocol://host.com' | ||
if (value == null) { | ||
@@ -37,3 +37,3 @@ return; | ||
return; | ||
} | ||
} | ||
o.protocol = value[1]; | ||
@@ -53,3 +53,3 @@ o.value = o.value.substring(value[0].length); | ||
o.value = o.value.replace(o.host,''); | ||
if (o.protocol === 'file' && o.host[0] == '/'){ | ||
@@ -67,3 +67,3 @@ o.host = o.host.substring(1); | ||
parseFile: function(o){ | ||
var value = /\/?([^\/]+\.[^\/]+)$/i.exec(o.value); | ||
var value = /\/?([^\/]+\.[^\/]+)$/i.exec(o.value); | ||
var file = value ? value[1] : null; | ||
@@ -73,3 +73,3 @@ if (file) { | ||
o.value = o.value.replace(file, ''); | ||
if (o.value[o.value.length - 1] == '/') { | ||
@@ -83,5 +83,5 @@ o.value = o.value.substring(0, o.value.length - 1); | ||
} | ||
var URI = function(uri) { | ||
@@ -95,3 +95,3 @@ if (uri == null) { | ||
uri = uri.replace(/\\/g,'/'); | ||
uri = uri.replace(/\\/g,'/'); | ||
@@ -101,8 +101,8 @@ this.value = uri; | ||
helper.parseHost(this); | ||
helper.parseSearch(this); | ||
helper.parseFile(this); | ||
this.path = this.value; | ||
return this; | ||
return this; | ||
} | ||
@@ -133,16 +133,16 @@ URI.combine = helper.combinePathes; | ||
} | ||
if (!path) { | ||
return uri; | ||
} | ||
if (this.protocol == 'file' && path[0] == '/') path = path.substring(1); | ||
uri.value = path; | ||
helper.parseSearch(uri); | ||
helper.parseFile(uri); | ||
if (uri.value) { | ||
path = uri.value.replace(/^\.\//i, ''); | ||
if (path[0] == '/') { | ||
@@ -156,3 +156,3 @@ uri.path = path; | ||
} | ||
uri.path = helper.combinePathes(uri.path, path); | ||
@@ -164,4 +164,6 @@ } | ||
var str = this.host ? this.protocol + '://' : ''; | ||
if (this.protocol === 'file') str += '/'; | ||
if (this.protocol === 'file') { | ||
str += '/'; | ||
} | ||
return str + helper.combinePathes(this.host, this.path, this.file) + (this.search || ''); | ||
@@ -224,5 +226,2 @@ }, | ||
toLocalFile: function() { | ||
if (this.protocol !== 'file') { | ||
return this.toString(); | ||
} | ||
return helper.combinePathes(this.host, this.path, this.file); | ||
@@ -234,9 +233,9 @@ }, | ||
} | ||
return helper.combinePathes(this.host, this.path); | ||
return helper.combinePathes(this.host, this.path, '/'); | ||
}, | ||
toDir: function(){ | ||
var str = this.toString(); | ||
return this.file ? str.substring(0, str.lastIndexOf('/')) : str; | ||
}, | ||
return this.file ? str.substring(0, str.lastIndexOf('/') + 1) : str; | ||
}, | ||
isRelative: function() { | ||
@@ -251,11 +250,11 @@ return !this.host; | ||
URI.combinePathes = helper.combinePathes; | ||
if (global.net == null) { | ||
global.net = {}; | ||
} | ||
global.net.URI = URI; | ||
})(typeof window === 'undefined' ? global : window); | ||
})(typeof window === 'undefined' ? global : window); |
@@ -118,21 +118,45 @@ /** | ||
function parseOverrides(program, config) { | ||
var array = program.rawArgs; | ||
for (var i = 0, x, length = array.length; i < length; i++) { | ||
var array = program.rawArgs, | ||
i = 0, | ||
length = array.length, | ||
action = config.action, | ||
actionFound = false, | ||
key, value, x; | ||
for (; i < length; i++) { | ||
x = array[i]; | ||
if (x[0] != '-') { | ||
if (x[0] === '-') { | ||
key = x.substring(1); | ||
value = i < length - 1 ? array[i+1] : null; | ||
if (value){ | ||
var c = value[0]; | ||
if (c == '"' || c == "'"){ | ||
value = value.substring(1, value.length - 1); | ||
} | ||
config[key] = value; | ||
continue; | ||
} | ||
config[key] = true; | ||
continue; | ||
} | ||
var key = x.substring(1), | ||
value = array[++i]; | ||
if (!value) { | ||
continue; | ||
} | ||
if (value[0] == '"') { | ||
value = value.substring(1, value.length - 1); | ||
} | ||
config[key] = value; | ||
if (actionFound){ | ||
var c = x[0]; | ||
if (c == '"' || c == "'"){ | ||
x = x.substring(1, x.length - 1); | ||
} | ||
(config.args || (config.args = [])).push(x); | ||
continue; | ||
} | ||
if (x == action){ | ||
actionFound = true; | ||
} | ||
} | ||
@@ -139,0 +163,0 @@ } |
@@ -5,4 +5,4 @@ window.DEBUG = true; | ||
if (window.DEBUG && window.location.hash.indexOf('!watch') > -1){ | ||
include.embed({ | ||
if (window.DEBUG ){ //&& window.location.hash.indexOf('!watch') > -1 | ||
include.plugin({ | ||
lib: 'include/include.autoreload' | ||
@@ -9,0 +9,0 @@ }); |
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
150542
4563
9
11
78
+ Addedopenurl@~1.1.0
+ Addedopenurl@1.1.1(transitive)