Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

includejs

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

includejs - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

build.js

10

package.json
{
"name": "includejs",
"description": "IncludeJS Resource Builder Tool",
"preferGlobal": "true",
"description": "IncludeJS Resource Builder Tool - CLI only",
"preferGlobal": true,
"author": {

@@ -9,3 +9,3 @@ "name": "Alexander Kit",

},
"version": "0.4.4",
"version": "0.4.5",
"bin": {

@@ -21,3 +21,4 @@ "includejs": "./includejs"

"jshint": "~0.9.1",
"socket.io": "~0.9.13"
"socket.io": "~0.9.13",
"libjs-class": "~1.0.1"
},

@@ -28,3 +29,2 @@ "repository": {

},
"preferGlobal": true,
"license": "MIT",

@@ -31,0 +31,0 @@ "engines": {

@@ -1,13 +0,26 @@

include.js({
helper: 'referenceHelper::refHelper'
}).done(function(resp) {
var program = require('commander');;
(function() {
if (!program.args[1]) {
return console.error('Path not defined.');
}
resp.refHelper.create(io.env.currentDir, program.args[2], program.args[1]);
return null;
});
include.exports = {
process: function(config, idfr) {
include.js({
helper: 'referenceHelper::refHelper'
}).done(function(resp) {
var args = require('commander').args,
path = config.path || args[1],
name = config.name || args[2];
if (!path || new io.Directory(path).exists() == false) {
console.error('Symbolic link points to undefined path', path);
idfr.resolve && idfr.resolve(1);
return;
}
resp.refHelper.create(io.env.currentDir, name, path);
idfr.resolve && idfr.resolve();
});
}
}
}());

@@ -1,18 +0,28 @@

include.js({
handler: ['files/includeRoutes']
}).done(function() {
(function() {
var w = window,
p = w.program,
path = p.args[1],
targetUri = new net.URI(process.cwd() + '/'),
sourceDir = new io.Directory(io.env.applicationDir.combine('/template/').combine(path));
if (sourceDir.exists() == false) {
return console.error('Source Directory Not Found - ', sourceDir.uri.toString());
}
include.exports = {
process: function(config, idfr) {
sourceDir.readFiles().copyTo(targetUri);
include.js({
io: ['files/includeRoutes']
}).done(function() {
return 0;
});
var folder = config.folder || global.program.args[1],
targetUri = new net.URI(process.cwd() + '/'),
sourceDir = new io.Directory(io.env.applicationDir.combine('/template/').combine(folder));
if (sourceDir.exists() == false) {
console.error('Source Directory Not Found - ', sourceDir.uri.toString());
idfr.resolve(1);
return;
}
sourceDir.readFiles().copyTo(targetUri);
idfr.resolve && idfr.resolve();
});
}
}
}());

@@ -99,3 +99,3 @@ include.js({

build: function(solution) {
build: function(solution, idfr) {
solution.output = {};

@@ -122,2 +122,3 @@ solution.bin = {};

idfr.resolve && idfr.resolve();
}

@@ -124,0 +125,0 @@ }

include.js({
script: 'html/Document::Document'
script: 'html/Document'
}).done(function(resp) {

@@ -9,11 +9,36 @@

doc.removeAll('script', 'src').removeAll('link', 'rel', 'stylesheet');
ruqq//
.arr(doc.getElementsByTagName('script')) //
.where(function(x) {
if (x.getAttribute('ignore')) {
return false;
}
return !!x.getAttribute('src');
}).each(function(x) {
x.parentNode.removeChild(x);
});
builtOutput.css && doc.appendResource('link', {
rel: 'stylesheet',
href: solution.uris.outputDirectory.combine('style.css').toRelativeString(solution.uri)
ruqq//
.arr(doc.getElementsByTagName('link')) //
.where(function(x) {
return x.getAttribute('rel') == 'stylesheet';
}).each(function(x) {
x.parentNode.removeChild(x);
});
if (builtOutput.css) {
var href = solution.uris.outputDirectory.combine('style.css').toRelativeString(solution.uri);
if (solution.config.version) {
href += '?v=' + solution.config.version;
}
doc.appendResource('link', {
rel: 'stylesheet',
href: href
});
}
if (builtOutput.lazy || builtOutput.load) {

@@ -30,5 +55,10 @@ var tag = doc.createTag('div', {

if (builtOutput.js) {
var src = solution.uris.outputDirectory.combine('script.js').toRelativeString(solution.uri);
if (solution.config.version) {
src += '?v=' + solution.config.version;
}
var tag = doc.createTag('script', {
type: 'application/javascript',
src: solution.uris.outputDirectory.combine('script.js').toRelativeString(solution.uri)
type: 'text/javascript',
src: src
});

@@ -35,0 +65,0 @@ doc.first('body').appendChild(tag);

@@ -1,10 +0,11 @@

void
function() {
var fs = require('fs');
(function() {
global.urlhelper = {
resolveAppUri: function(url, current) {
if (url[0] == '/') return url;
if (!current || url.substring(0, 4) == 'file') return '/';
if (url[0] == '/') {
return url;
}
if (!current || url.substring(0, 4) == 'file') {
return '/';
}

@@ -15,3 +16,5 @@ var index = current.lastIndexOf('/');

resolveUri: function(url, parentLocation) {
if (solution == null) return new net.URI('');
if (solution == null) {
return new net.URI('');
}

@@ -28,3 +31,5 @@ if (url[0] == '/'){

getDir: function(url) {
if (!url) return '/';
if (!url) {
return '/';
}
var index = url.lastIndexOf('/');

@@ -40,15 +45,3 @@ return index == -1 ? '' : url.substring(index + 1, -index);

}
global.xhr = {
load: function(url, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
xhr.readyState == 4 && callback(xhr.responseText);
};
xhr.open('GET', url, false);
xhr.send();
}
}
}();
}());

@@ -1,67 +0,71 @@

var r = global.ruqq,
jsdom = require('jsdom').jsdom;
(function() {
var r = global.ruqq,
jsdom = require('jsdom').jsdom;
var Document = Class({
Construct: function(html) {
var dom = jsdom('<!DOCTYPE html><html>' + html + '</html>');
Object.extend(dom.__proto__, this.__proto__);
return dom;
},
removeAll: function(tagName, ifattr, value) {
var elements = this.getElementsByTagName(tagName);
for (var i = 0; i < elements.length; i++) {
var Document = Class({
Construct: function(html) {
var dom = jsdom('<!DOCTYPE html><html>' + html + '</html>');
if (ifattr && !elements[i].getAttribute(ifattr)) {
continue;
}
if (value && elements[i].getAttribute(ifattr) != value) {
continue;
}
elements[i].parentNode.removeChild(elements[i]);
}
return this;
},
createTag: function(tagName, attr) {
var tag = this.createElement(tagName);
for (var key in attr) {
switch (key) {
case 'innerHTML':
tag[key] = attr[key];
continue;
Object.extend(dom.__proto__, this.__proto__);
return dom;
},
removeAll: function(tagName, ifattr, value) {
var elements = this.getElementsByTagName(tagName);
for (var i = 0; i < elements.length; i++) {
if (ifattr && !elements[i].getAttribute(ifattr)) {
continue;
}
if (value && elements[i].getAttribute(ifattr) != value) {
continue;
}
elements[i].parentNode.removeChild(elements[i]);
}
return this;
},
createTag: function(tagName, attr) {
var tag = this.createElement(tagName);
for (var key in attr) {
switch (key) {
case 'innerHTML':
tag[key] = attr[key];
continue;
}
tag.setAttribute(key, attr[key]);
}
return tag;
},
appendResource: function(tagName, attr) {
var tag = this.createTag(tagName, attr);
this.first('head').appendChild(tag)
return tag;
},
tag.setAttribute(key, attr[key]);
}
return tag;
},
appendResource: function(tagName, attr) {
var tag = this.createTag(tagName, attr);
this.first('head').appendChild(tag)
return tag;
},
getAllAttributes: function(tagName, attr) {
return r.arr(this.getElementsByTagName(tagName)).where(function(x) {
return !!x.getAttribute(attr) && /:\/\/|^\/\//.test(x.getAttribute(attr)) == false;
}).map(function(x) {
return x.getAttribute(attr);
});
},
first: function(tagName, arg) {
var elements = this.getElementsByTagName(tagName);
getAllAttributes: function(tagName, attr,fn) {
return r.arr(this.getElementsByTagName(tagName)).where(function(x) {
return !!x.getAttribute(attr) && /:\/\/|^\/\//.test(x.getAttribute(attr)) == false;
})
.where(fn || function(){return true;})
.map(function(x) {
return x.getAttribute(attr);
});
},
first: function(tagName, arg) {
var elements = this.getElementsByTagName(tagName);
if (typeof arg == 'function') {
for (var i = 0, x, length = elements.length; x = elements[i], i < length; i++) {
if (arg(x)) return x;
if (typeof arg == 'function') {
for (var i = 0, x, length = elements.length; x = elements[i], i < length; i++) {
if (arg(x)) return x;
}
}
return elements[0];
}
});
return elements[0];
}
});
include.exports = Document;
include.exports = Document;
}());

@@ -29,2 +29,3 @@ (function() {

_hooks.push(new Hook(regexp, name, handler));
return this;
},

@@ -35,4 +36,9 @@ trigger: function(funcName, file) {

});
}
return this;
},
clear: function(){
_hooks = [];
return this;
}
});
}());

@@ -80,3 +80,5 @@

var folder = urlhelper.getDir(to);
if (fs.existsSync(folder) == false) fsextra.mkdirpSync(folder);
if (fs.existsSync(folder) == false) {
fsextra.mkdirpSync(folder);
}

@@ -83,0 +85,0 @@ copyFileSync(from, to);

!function() {
if (!global.config.minify) {
return;
}
include.exports = function(file){
if (!global.config.minify) {
return;
}
file.content = require('clean-css').process(file.content);

@@ -9,0 +12,0 @@ }

include.js({
script: 'helper/stdout::stdout'
script: 'helper/stdout::stdout'
}).done(function(resp) {
if (!global.config.jshint) {
return;
}
var jshint = require('jshint').JSHINT,
config = global.config.jshint,
globals = config.globals,
options = config.options,
ignore = config.ignore,
var jshint = require('jshint').JSHINT,
color = resp.stdout.color;
include.exports = function(file) {
var config = global.config.jshint;
if (!config){
return;
}
color = resp.stdout.color;
include.exports = function(file) {
/**
* DO not apply jshint on minimized scripts
*/
if (file.uri.file.indexOf('.min.') > -1){
return;
}
if (ignore && ignore.hasOwnProperty(file.uri.file)){
return;
}
var start = Date.now(),
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+'}'));
if (!result){
jshint.errors.forEach(function(e) {
if (!e){
return;
}
var evidence = e.evidence,
character = e.character,
pos;
if (evidence){
var msg = String.format(color('[yellow{%1}:yellow{%2}] bold{%3}'),
'L' + e.line,
'C' + character,
e.reason);
console.log(msg);
}else{
console.log(e.reason);
}
});
}
var globals = config.globals,
options = config.options,
ignore = config.ignore;
if (!global.config.jshint) {
return;
}
/**
* DO not apply jshint on minimized scripts
*/
if (file.uri.file.indexOf('.min.') > -1) {
return;
}
if (ignore && ignore.hasOwnProperty(file.uri.file)) {
return;
}
var start = Date.now(),
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 + '}'));
if (!result) {
jshint.errors.forEach(function(e) {
if (!e) {
return;
}
var evidence = e.evidence,
character = e.character,
pos;
if (evidence) {
var msg = String.format(color('[yellow{%1}:yellow{%2}] bold{%3}'), 'L' + e.line, 'C' + character, e.reason);
console.log(msg);
} else {
console.log(e.reason);
}
});
}
};
});
});

@@ -1,36 +0,37 @@

!function() {
if (!global.config.minify) {
return;
}
!
function() {
var uglify = require("uglify-js"),
config = global.config.uglify;
var uglify = require("uglify-js");
include.exports = function(file) {
console.log('Uglify... [start]');
var start = Date.now(),
compressor, ast;
if (!global.config.minify) {
return;
}
ast = uglify.parse(file.content);
ast.figure_out_scope();
console.log('Uglify... [start]');
var config = global.config.uglify,
start = Date.now(),
compressor, ast;
compressor = uglify.Compressor(config);
ast = ast.transform(compressor);
ast.figure_out_scope();
ast.compute_char_frequency();
ast.mangle_names();
ast = uglify.parse(file.content);
ast.figure_out_scope();
//ast = pro.ast_squeeze(ast);
file.content = ast.print_to_string();
console.log('Uglify... [end %sms]', Date.now() - start);
compressor = uglify.Compressor(config);
ast = ast.transform(compressor);
ast.figure_out_scope();
ast.compute_char_frequency();
ast.mangle_names();
//ast = pro.ast_squeeze(ast);
file.content = ast.print_to_string();
console.log('Uglify... [end %sms]', Date.now() - start);
};
}();

@@ -1,3 +0,2 @@

;
(function(w) {
(function(global) {

@@ -16,3 +15,5 @@ var helper = {

var prototype;
if (x == null) return;
if (x == null) {
return;
}
switch (typeof x) {

@@ -35,5 +36,7 @@ case 'function':

if (typeof original !== 'object') return;
if (typeof original !== 'object') {
return;
}
this.extendPrototype = original.__proto__ == null ? this.protoLess : this.proto;
this.extendPrototype = original['__proto__'] == null ? this.protoLess : this.proto;
this.extendPrototype(_class, _base, _extends, original);

@@ -45,38 +48,49 @@ },

prototype.constructor = _class.prototype.constructor;
if (_extends != null) {
proto.__proto__ = {};
helper.each(_extends, function(x) {
helper.extendProto(proto.__proto__, x);
proto['__proto__'] = {};
helper.each(_extends, function(x) {
helper.extendProto(proto['__proto__'], x);
});
proto = proto.__proto__;
proto = proto['__proto__'];
}
if (_base != null) {
proto.__proto__ = _base.prototype;
proto['__proto__'] = _base.prototype;
}
_class.prototype = prototype;
_class.prototype = prototype;
},
/** browser that doesnt support __proto__ */
protoLess: function(_class, _base, _extends, original) {
if (_base != null) {
var proto = {},
tmp = new Function;
tmp = function(){};
tmp.prototype = _base.prototype;
_class.prototype = new tmp();
_class.constructor = _base;
_class.prototype = new tmp();
_class.prototype.constructor = _class;
}
helper.extendProto(_class.prototype, original);
if (_extends != null) {
helper.each(_extends, function(x){
helper.extendProto(_class.prototype, x);
var a = {};
helper.extendProto(a, x);
delete a.constructor;
for(var key in a){
_class.prototype[key] = a[key];
}
});
}
}
}
};
w.Class = function(data) {
global.Class = function(data) {
var _base = data.Base,

@@ -86,18 +100,35 @@ _extends = data.Extends,

_construct = data.Construct,
_class = null;
_class = null,
key;
if (_base != null) delete data.Base;
if (_extends != null) delete data.Extends;
if (_static != null) delete data.Static;
if (_construct != null) delete data.Construct;
if (_base != null) {
delete data.Base;
}
if (_extends != null) {
delete data.Extends;
}
if (_static != null) {
delete data.Static;
}
if (_construct != null) {
delete data.Construct;
}
if (_base == null && _extends == null) {
if (_construct == null) _class = function() {};
else _class = _construct;
if (_construct == null) {
_class = function() {};
}
else {
_class = _construct;
}
data.constructor = _class.prototype.constructor;
if (_static != null) {
for (var key in _static) _class[key] = _static[key];
for (key in _static) {
_class[key] = _static[key];
}
}
_class.prototype = data;

@@ -114,4 +145,7 @@ return _class;

x = null;
for (var i = 0; x = isarray ? _extends[i] : _extends, isarray ? i < length : i < 1; i++) {
if (typeof x === 'function') x.apply(this, arguments);
for (var i = 0; isarray ? i < length : i < 1; i++) {
x = isarray ? _extends[i] : _extends;
if (typeof x === 'function') {
x.apply(this, arguments);
}
}

@@ -126,10 +160,16 @@ }

var r = _construct.apply(this, arguments);
if (r != null) return r;
if (r != null) {
return r;
}
}
return this;
};
if (_static != null) {
for (key in _static) {
_class[key] = _static[key];
}
}
if (_static != null) for (var key in _static) _class[key] = _static[key];
helper.extendClass(_class, _base, _extends, data);

@@ -142,6 +182,6 @@

return _class;
}
};
})(window);
}(typeof window === 'undefined' ? global : window));

@@ -125,3 +125,4 @@

var routes = {};
var routes = {},
regexpAlias = /([^\\\/]+)\.\w+$/;

@@ -266,2 +267,9 @@ return {

return routes;
},
parseAlias: function(resource){
var url = resource.url,
result = regexpAlias.exec(url);
return result && result[1];
}

@@ -343,3 +351,9 @@ };

readystatechanged: function(state) {
this.state = state;
if (this.state === 4){
global.include = this;
}
for (var i = 0, x, length = this.callbacks.length; i < length; i++) {

@@ -488,2 +502,9 @@ x = this.callbacks[i];

}
},
/**
* Create new Resource Instance,
* as sometimes it is necessary to call include. on new empty context
*/
instance: function(){
return new Resource();
}

@@ -718,2 +739,5 @@ };

}
if (this.response == null){
this.response = {};
}

@@ -726,3 +750,4 @@

resource.index = this.calcIndex(type, namespace);
// obsolete - we only use alias
//////resource.index = this.calcIndex(type, namespace);
resource.on(4, this.childLoaded.bind(this));

@@ -736,18 +761,18 @@ }.bind(this));

*/
calcIndex: function(type, namespace) {
if (this.response == null) {
this.response = {};
}
switch (type) {
case 'js':
case 'load':
case 'ajax':
var key = type + 'Index';
if (this.response[key] == null) {
this.response[key] = -1;
}
return ++this.response[key];
}
return -1;
},
//////calcIndex: function(type, namespace) {
////// if (this.response == null) {
////// this.response = {};
////// }
////// switch (type) {
////// case 'js':
////// case 'load':
////// case 'ajax':
////// var key = type + 'Index';
////// if (this.response[key] == null) {
////// this.response[key] = -1;
////// }
////// return ++this.response[key];
////// }
////// return -1;
//////},

@@ -759,22 +784,26 @@ childLoaded: function(resource) {

switch (resource.type) {
var type = resource.type;
switch (type) {
case 'js':
case 'load':
case 'ajax':
//////if (this.response == null) {
////// this.response = {};
//////}
if (resource.route.alias){
this.response[resource.route.alias] = resource.exports;
var alias = resource.route.alias || Routes.parseAlias(resource),
obj = type == 'js' ? this.response : (this.response[type] || (this.response[type] = {}));
if (alias){
obj[alias] = resource.exports;
break;
}else{
console.warn('Resource Alias is Not defined', resource);
}
var obj = (this.response[resource.type] || (this.response[resource.type] = []));
if (resource.namespace != null) {
obj = Helper.ensureArray(obj, resource.namespace);
}
obj[resource.index] = resource.exports;
///////@TODO - obsolete - use only alias
//////var obj = (this.response[resource.type] || (this.response[resource.type] = []));
//////
//////if (resource.namespace != null) {
////// obj = Helper.ensureArray(obj, resource.namespace);
//////}
//////obj[resource.index] = resource.exports;
break;

@@ -781,0 +810,0 @@ }

@@ -1,3 +0,3 @@

;
(function(w) {
(function(global) {
'use strict';

@@ -13,3 +13,5 @@

for (var i = 0; i < args.length; i++) {
if (!args[i]) continue;
if (!args[i]) {
continue;
}
if (!str) {

@@ -19,3 +21,5 @@ str = args[i];

}
if (str[str.length - 1] != '/') str += '/';
if (str[str.length - 1] != '/') {
str += '/';
}
str += args[i][0] == '/' ? args[i].substring(1) : args[i];

@@ -28,3 +32,5 @@ }

if (value == null) return;
if (value == null) {
return;
}
if (value[2] == null){

@@ -35,9 +41,8 @@ o.protocol = 'file';

o.protocol = value[1];
if (value[0] == null || !o.value || !o.value.substring){
console.log('IS NULL', o);
}
o.value = o.value.substring(value[0].length);
},
parseHost: function(o){
if (o.protocol == null) return;
if (o.protocol == null) {
return;
}
var i = o.value.indexOf('/', 2);

@@ -77,10 +82,15 @@ if (~i){

}
if (w.net == null) w.net = {};
w.net.URI = function(uri) {
if (uri == null) return this;
if (helper.isURI(uri)) return uri.combine('');
uri = uri.replace(/\\/g,'/');
var URI = function(uri) {
if (uri == null) {
return this;
}
if (typeof uri === 'object' && typeof uri.combine === 'function') {
return uri.combine('');
}
uri = uri.replace(/\\/g,'/');
this.value = uri;

@@ -96,5 +106,5 @@ helper.parseProtocol(this);

}
w.net.URI.combine = helper.combinePathes;
URI.combine = helper.combinePathes;
w.net.URI.prototype = {
URI.prototype = {
cdUp: function() {

@@ -111,5 +121,7 @@ if (!this.path || this.path == '/') return this;

combine: function(path) {
if (helper.isURI(path)) path = path.toString();
if (typeof path === 'object' && typeof path.combine === 'function') {
path = path.toString();
}
var uri = new net.URI();
var uri = new URI();
for (var key in this) {

@@ -121,3 +133,5 @@ if (typeof this[key] === 'string') {

if (!path) return uri;
if (!path) {
return uri;
}

@@ -151,3 +165,6 @@ if (this.protocol == 'file' && path[0] == '/') path = path.substring(1);

return str + helper.combinePathes(this.host, this.path, this.file) + (this.search || '');
},
},
toPathAndQuery: function(){
return helper.combinePathes(this.path, this.file) + (this.search || '');
},
/**

@@ -157,4 +174,8 @@ * @return Current URI Path{String} that is relative to @arg1 URI

toRelativeString: function(uri) {
if (typeof uri === 'string') uri = new w.net.URI(uri);
if (uri.protocol != this.protocol || uri.host != this.host) return this.toString();
if (typeof uri === 'string') {
uri = new URI(uri);
}
if (uri.protocol != this.protocol || uri.host != this.host) {
return this.toString();
}

@@ -166,2 +187,3 @@ if (this.path.indexOf(uri.path) == 0) { /** host folder */

}
/** sub folder */

@@ -174,3 +196,5 @@ var current = this.path.split('/');

for (; i < length; i++) {
if (current[i] == relative[i]) continue;
if (current[i] == relative[i]) {
continue;
}
break;

@@ -195,2 +219,4 @@ }

}
return this.toString();

@@ -200,18 +226,22 @@ },

toLocalFile: function() {
if (this.protocol !== 'file') return this.toString();
if (this.protocol !== 'file') {
return this.toString();
}
return helper.combinePathes(this.host, this.path, this.file);
},
toLocalDir: function() {
if (this.protocol !== 'file') return this.toDir();
if (this.protocol !== 'file') {
return this.toDir();
}
return helper.combinePathes(this.host, this.path, '/');
},
toDir: function(){
toDir: function(){
var str = this.toString();
return this.file ? str.substring(0, str.lastIndexOf('/') + 1) : str;
},
},
isRelative: function() {
return !this.host;
},
getName: function(){
getName: function(){
return this.file.replace('.' + this.extension,'');

@@ -221,3 +251,12 @@ }

w.net.URI.combinePathes = helper.combinePathes;
})(window);
URI.combinePathes = helper.combinePathes;
if (global.net == null) {
global.net = {};
}
global.net.URI = URI;
})(typeof window === 'undefined' ? global : window);

@@ -9,3 +9,4 @@ /**

var actions = ['template', //
var actions = [ //
'template', //
'reference', //

@@ -15,3 +16,3 @@ 'globals', //

'server', //
],
'shell'],
program = require('commander'),

@@ -31,39 +32,59 @@ args = program.args,

if (actions.indexOf(entry) > 1) {
global.config = {
action: entry,
state: 4
};
global.config = [{
action: entry
}];
global.config.state = 4;
return;
}
var file = new io.File(entry),
config = {};
global.config = config;
var file = new io.File(entry);
if (file.uri.extension == 'config') {
if (file.exists() == false) {
console.error('File doesnt exists (404)', file.uri.toLocalFile());
return;
if (file.exists() == false) {
console.error('File doesnt exists (404)', file.uri.toLocalFile());
return;
}
switch(file.uri.extension){
case 'config':
global.config = JSON.parse(file.read());
break;
case 'js':
eval(file.read());
if (global.config == null){
console.error('Included Javascript as configuration exposed no config property');
global.config = {
state: 0
};
return;
}
break;
default:
global.config = {
file: file.uri.toLocalFile()
}
break;
}
config = global.config;
if (config instanceof Array === false) {
config = [config];
}
for (var i = 0, x, length = config.length; i < length; i++) {
x = config[i];
if ('file' in x) {
parseFile(x);
parseType(x);
}
config = JSON.parse(file.read());
} else {
config = {
file: file.uri.toLocalFile()
if (i == 0) {
parseOverrides(program, config);
}
}
parseFile(config);
parseType(config);
parseOverrides(program, config);
if (new io.File(config.uri.toLocalFile()).exists() == false) {
console.error('File doesnt exists (404)', config.uri.toLocalFile());
return;
}
if (!config.type) {
console.error('Unknown solution type', config.type);
return;
}
config.state = 4;

@@ -82,3 +103,3 @@

if (!config.type) {
var ext = config.uri.extension;

@@ -115,5 +136,5 @@ config.type = {

}
include.exports = (global.config = config);
});

@@ -6,4 +6,3 @@ include.js({

var w = window,
r = ruqq,
var r = global.ruqq,
helper = {

@@ -44,3 +43,3 @@ rewriteResource: function(doc, resource) {

w.include.promise('parser').html = {
include.promise('parser').html = {
rewriteUrls: function(resource, line1, line2) {

@@ -85,4 +84,9 @@ var json = {},

doc.getAllAttributes('script', 'src').each(add.bind(this, 'js'));
doc.getAllAttributes('link', 'href').each(add.bind(this, 'css'));
doc.getAllAttributes('script', 'src', function(x){
return !x.getAttribute('ignore');
}).each(add.bind(this, 'js'));
doc.getAllAttributes('link', 'href', function(x){
return !x.getAttribute('ignore');
}).each(add.bind(this, 'css'));

@@ -103,3 +107,3 @@

solution.loader = new w.parser.Loader(directory.combine(loaderUrl), loaderMain);
solution.loader = new global.parser.Loader(directory.combine(loaderUrl), loaderMain);

@@ -106,0 +110,0 @@

@@ -10,6 +10,19 @@ include.js('resource.js::Resource').done(function(resp) {

global.Solution = Class({
Construct: function(type, uri, config, idfr) {
Construct: function(config, idfr) {
/** singleton */
global.solution = this;
var uri = config.uri,
type = config.type;
if (!uri || new io.File(uri.toLocalFile()).exists() == false) {
console.error('File doesnt exists (404)', uri.toLocalFile());
idfr.resolve(1);
return;
}
if (!type) {
console.error('Unknown solution type', type);
idfr.resolve(1);
return;
}

@@ -77,16 +90,2 @@ this.directory = uri.toDir();

////config = global.include.cfg();
////for(var key in config) {
//// delete config[key];
////}
////
////config = global.include.routes();
////for(var key in config) {
//// delete config[key];
////}
console.log('Solution Ready');

@@ -97,3 +96,2 @@ },

process: function() {
//-this.resource.process();
this.resource.load();

@@ -100,0 +98,0 @@

include.js({
parser: ['js', 'css', 'html'],
script: ['io/files/style', 'project/solution']
parser: ['js', 'css', 'html'],
script: ['io/files/style', 'project/solution']
}).done(function() {
var config = global.config;
if (!(config && config.state === 4)){
console.error('>>> Config was not loaded');
return null;
}
new Solution(config.type, config.uri, config, {
resolve: function(solution){
console.log('Resources Loaded');
switch (solution.config.action) {
case 'project-import':
case 'project-reference':
include.js({
action: 'resourceRoutes::resourceRoutes'
}).done(function(resp){
resp.resourceRoutes.action(solution.config.action);
});
break;
case 'build':
include.js({
script: 'builder/build::builder'
}).done(function(resp){
resp.builder.build(solution);
});
break;
var config = global.config;
include.exports = {
process: function(config, idfr) {
if (config.uri instanceof net.URI === false){
console.error('File is not defined', config.file);
idfr.resolve && idfr.resolve(1);
return;
}
}
}).process();
return null;
if (new io.File(config.uri.toLocalFile()).exists() == false) {
console.error('File doesnt exists (404)', config.uri.toLocalFile());
idfr.resolve && idfr.resolve(1);
return;
}
if (!config.type) {
console.error('Unknown solution type', config.type);
idfr.resolve && idfr.resolve(1);
return;
}
/** @TODO lots of modules, depends on global config, so that current config to global */
var globalConfig = global.config,
listener = {
resolve: function(){
global.config = globalConfig;
idfr && idfr.resolve();
}
};
global.config = config;
new Solution(config, {
resolve: function(solution) {
console.log('Resources Loaded');
switch (solution.config.action) {
case 'project-import':
case 'project-reference':
include.js('resourceSource.js').done(function(resp) {
resp.resourceSource.action(solution.config.action, listener);
});
break;
case 'build':
include.js({
script: 'builder/build'
}).done(function(resp) {
resp.build.build(solution, listener);
});
break;
}
}
}).process();
}
}
});

@@ -21,9 +21,12 @@ include.js({

request: function(request, response) {
var path = url.parse(request.url).pathname,
fullPath = pathUtil.join(folder, path);
fullPath = net.URI.combine(folder, path);
var file = new File(fullPath);
var uri = new net.URI(request.url);
if (!uri.file){
uri = uri.combine('index.html');
}
var fullPath = net.URI.combine(folder, uri.toLocalFile()),
file = new File(fullPath);
if (file.exists()) {

@@ -30,0 +33,0 @@ var mimeType = MimeTypes[file.uri.extension] || 'text/plain',

@@ -5,3 +5,3 @@

var routes = {
'/': 'index'
//'/': 'index'
};

@@ -8,0 +8,0 @@ var Routes = Class({

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc