get-nodejs.js revision 24dd9854c3a4824364315b958c1748cbb5fb13ee
/**
* NodeJS specific Get module used to load remote resources. It contains the same signature as the default Get module so there is no code change needed.
* @module get-nodejs
* @class GetNodeJS
*/
Y.Get = function() {};
//Setup the default config base path
/**
* Get the port number from a URL based on the port from the URL module or http(s)
* @method urlInfoPort
* @param {Object} urlInfo Info from `require('url').parse(url)`
* @return {Number} The port number
*/
};
/**
* Escape the path for Windows, they need to be double encoded when used as `__dirname` or `__filename`
* @method escapeWinPath
* @protected
* @param {String} p The path to modify
* @return {String} The encoded path
*/
var escapeWinPath = function(p) {
return p.replace(/\\/g, '\\\\');
};
/**
* Takes the raw JS files and wraps them to be executed in the YUI context so they can be loaded
* into the YUI object
* @method _exec
* @private
* @param {String} data The JS to execute
* @param {String} url The path to the file that was parsed
* @param {Callback} cb The callback to execute when this is completed
* @param {Error} cb.err=null Error object
* @param {String} cb.url The URL that was just parsed
*/
dirName = '.';
fileName = 'remoteResource';
}
"var process = YUI.process;" +
"var require = function(file) {" +
" if (file.indexOf('./') === 0) {" +
" file = __dirname + file.replace('./', '/'); }" +
" return YUI.require(file); }; " +
data + " ;return YUI; })";
//var mod = "(function(YUI) { " + data + ";return YUI; })";
};
/**
* Fetches the content from a remote URL or a file from disc and passes the content
* off to `_exec` for parsing
* @method _include
* @private
* @param {Callback} cb The callback to fire once the content has been executed via `_exec`
*/
p = Y.Get.urlInfoPort(u),
if (u.search) {
}
var h = http;
h = https;
}
h.get({
port: p,
}, function(res) {
var mod = '';
});
});
});
} else {
//Needs to be in useSync
} else {
});
}
}
};
//Y.log('Get end: ' + cb.onEnd);
}
//Y.log('Get pass: ' + cb.onSuccess);
}
//Y.log('Get fail: ' + er);
}
};
/**
* Override for Get.script for loading local or remote YUI modules.
* @method script
* @param {Array|String} s The URL's to load into this context
* @param {Callback} cb The callback to execute once the transaction is complete.
*/
var A = Y.Array,
check = function() {
if (c === l) {
}
};
for (i=0; i<l; i++) {
Y.Get._include(url, function(err, url) {
if (!Y.config) {
Y.config = {
debug: true
};
}
if (err) {
if (err.stack) {
A.each(err.stack.split('\n'), function(frame) {
});
} else {
console.log(err);
}
} else {
c++;
check();
}
});
}
};