Permalink
Browse files

More RLS Updates

  • Loading branch information...
1 parent a8bde72 commit 2e21b132b36f02c8814b42314e07d71b7ffa8c6a @davglass davglass committed Jan 18, 2011
Showing with 76 additions and 22 deletions.
  1. +1 −0 examples/2in3-meta.js
  2. +1 −0 examples/gallery-meta.js
  3. +12 −7 examples/rls.js
  4. +52 −7 lib/yui3-rls.js
  5. +10 −8 lib/yui3-yui3.js
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -4,22 +4,27 @@
var start = (new Date()).getTime();
var yui3 = require('yui3');
yui3.rls({
- //m: 'yui,loader,dd,widget,autocomplete,gallery-yql,yui2-datatable',
- m: 'dd,widget,autocomplete,gallery-yql,yui2-datatable',
- env: 'node,attribute',
+ m: 'yui,loader,dd,widget,autocomplete,gallery-yql,yui2-datatable,gallery-aui-toolbar',
+ //m: 'dd,widget,autocomplete,gallery-yql,yui2-datatable',
+ //env: 'node,attribute',
v: '3.3.0',
gv: '2010.09.22',
- '2in3v': '0.0.3'//,
- //filt: 'RAW',
+ //parse: true, //This parses the file content and returns it as the last arg
+ gmeta: __dirname + '/gallery-meta.js',
+ yui2meta: __dirname + '/2in3-meta.js',
+ //filt: 'debug',
+ '2in3v': '2.8.0'
}, function(js, css, data) {
var end = (new Date()).getTime() - start;
console.log('Callback..');
console.log(js);
console.log(css);
var size = 0;
for (var i in data) {
- size += data[i].length;
- console.log('i: ', i, (data[i].length));
+ if (data[i]) {
+ size += data[i].length;
+ console.log('i: ', i, (data[i].length));
+ }
}
console.log('Total: ', [].concat(js, css).length);
console.log('Data: ', Object.keys(data).length);
View
@@ -14,6 +14,29 @@ exports.rls = function(YUI, config, fn) {
YUI.GlobalConfig.debug = false;
//Replace the default -debug with -min so all the files are -min files.
YUI.GlobalConfig.loaderPath = YUI.GlobalConfig.loaderPath.replace('-debug', '-min');
+
+ var parseContent = false;
+ if (config.parse) {
+ parseContent = config.parse;
+ }
+
+ var gMeta, yui2Meta;
+ if (config.gmeta) {
+ gMeta = require(config.gmeta).Gallery;
+ if (gMeta[config.gv]) {
+ gMeta = gMeta[config.gv];
+ } else {
+ gMeta = null;
+ }
+ }
+ if (config.yui2meta) {
+ yui2Meta = require(config.yui2meta).YUI2;
+ if (yui2Meta[YUI.GlobalConfig.groups.yui2.yui2Version]) {
+ yui2Meta = yui2Meta[YUI.GlobalConfig.groups.yui2.yui2Version];
+ } else {
+ yui2Meta = null;
+ }
+ }
//Add the default yui file, in case we are working with a full combo file.
var files = [YUI.GlobalConfig.base + 'yui/yui-min.js'],
@@ -34,17 +57,27 @@ exports.rls = function(YUI, config, fn) {
};
//Here is where we grab the filename of the file that is requested.
+
+
YUI.include = function(file, cb) {
+ var pFile = parseContent;
+ if (file.indexOf('loader-min') > 0) {
+ pFile = true;
+ }
if (grab) {
files.push(file);
}
//Call the original YUI.include.
- inc(file, function(err, data, info) {
- if (grab) {
- fileData[info.file] = info.data;
- }
+ if (pFile) {
+ inc(file, function(err, data, info) {
+ if (grab && parseContent) {
+ fileData[info.file] = info.data;
+ }
+ cb(null, function() {});
+ });
+ } else {
cb(null, function() {});
- });
+ }
}
//Setup the YUI instance config
var yc = {};
@@ -53,9 +86,21 @@ exports.rls = function(YUI, config, fn) {
if (config.lang) {
yc.lang = config.lang;
}
-
+ if (gMeta) {
+ yc.modules = gMeta;
+ }
+ if (yui2Meta) {
+ if (!yc.modules) {
+ yc.modules = {};
+ }
+ for (var i in yui2Meta) {
+ yc.modules[i] = yui2Meta[i];
+ }
+ }
+
//Create the new instance.
var Y = YUI(yc);
+
//Tell the YUI.include file that it can grab files.
var grab = true;
@@ -131,7 +176,7 @@ exports.rls = function(YUI, config, fn) {
var c = 1;
[].concat(files, Y.config._cssLoad).forEach(function(v) {
if (!fileData[v]) {
- missing.push(v);
+ //missing.push(v);
}
});
View
@@ -6,9 +6,7 @@ var sys = require(process.binding('natives').util ? 'util' : 'sys'),
var defaultConfig = {
core: '',
- gallery: '',
- '2in3': '',
- 'yui2': ''
+ gallery: ''
};
exports.configure = function(c) {
@@ -24,6 +22,7 @@ exports.configure = function(c) {
}
//Is gallery installed?
var gallery = false,
+ twoInThreeVersion,
//Is the 2in3 project installed?
twoIn3 = false;
@@ -39,7 +38,8 @@ exports.configure = function(c) {
//Convert yui2 to a 2in3 config
if (c.yui2) {
- c['2in3'] = c.yui2;
+ //c['2in3'] = c.yui2;
+ twoInThreeVersion = c.yui2;
delete c.yui2;
}
@@ -59,7 +59,7 @@ exports.configure = function(c) {
try {
//Load 2in3
- twoIn3 = require('yui3-2in3' + c['2in3']).path();
+ twoIn3 = require('yui3-2in3').path();
} catch (e) {}
YUI.loadSync = false;
@@ -103,10 +103,11 @@ exports.configure = function(c) {
}
if (twoIn3) {
- var YUI2_VERSION = '2.8.1';
+ var YUI2_VERSION = twoInThreeVersion || '2.8.1';
YUI.GlobalConfig.groups.yui2 = {
+ yui2Version: YUI2_VERSION,
combine: false,
ext: false,
base: twoIn3 + '/dist/' + YUI2_VERSION + '/build/',
@@ -171,7 +172,7 @@ exports.configure = function(c) {
}
};
- YUI.prototype.fetch = function(url, o) {
+ YUI.prototype.fetch = YUI.prototype.load = function(url, o) {
if (!url) { return; }
var cb = {};
@@ -320,7 +321,8 @@ exports.configure = function(c) {
var urlInfo = url.parse(file, parseQueryString=false),
req_url = urlInfo.pathname,
- host = http.createClient(YUI.urlInfoPort(urlInfo), urlInfo.hostname);
+ p = YUI.urlInfoPort(urlInfo),
+ host = http.createClient(p, urlInfo.hostname, ((p === 443) ? true : false));
if (urlInfo.search) {
req_url += urlInfo.search;

0 comments on commit 2e21b13

Please sign in to comment.