Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
much better about YUI module dependencies when calculating for the cl…
Browse files Browse the repository at this point in the history
…ient
  • Loading branch information
drewfish committed Oct 4, 2012
1 parent fe803c6 commit dcaac36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/app/addons/rs/yui.server.js
Expand Up @@ -455,6 +455,7 @@ YUI.add('addon-rs-yui', function(Y, NAME) {
var loader,
m,
module,
oldYUAnodejs,
info,
warn,
sortedPaths = {};
Expand All @@ -479,6 +480,11 @@ YUI.add('addon-rs-yui', function(Y, NAME) {
// using the same context as this calculation.
delete YUI.Env._renderedMods;

// Trick the loader into thinking it's -not- running on nodejs.
// This is the official way to do it.
oldYUAnodejs = Y.UA.nodejs;
Y.UA.nodejs = ('server' === env);

// Use ignoreRegistered here instead of the old `delete YUI.Env._renderedMods` hack
loader = new Y.Loader({ ignoreRegistered: true });
// Only override the default if it's required
Expand All @@ -489,6 +495,8 @@ YUI.add('addon-rs-yui', function(Y, NAME) {
loader.addGroup({modules: modules}, mojit);
loader.calculate({required: required});

Y.UA.nodejs = oldYUAnodejs;

for (m = 0; m < loader.sorted.length; m += 1) {
module = loader.sorted[m];
info = loader.moduleInfo[module];
Expand Down

0 comments on commit dcaac36

Please sign in to comment.