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

much better about YUI module dependencies when calculating for the client #595

Merged
merged 2 commits into from Oct 4, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,
originalYUAnodejs,
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.
originalYUAnodejs = 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 = originalYUAnodejs;

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