Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mv yuiuse.js to management/util.js

rm unused deps
  • Loading branch information...
commit 14f4f4ec5df0a09d6cfea05b6cff73b257952580 1 parent 778764d
@isao isao authored
View
6 lib/app/commands/build/index.js
@@ -10,11 +10,7 @@ var path = require('path'),
writer = require('./writer'),
util = require(BASE + 'lib/management/utils'),
- Y = require('./yuiuse')({
- 'escape': null,
- 'json-parse': null,
- 'json-stringify': null,
- 'mojito-util': BASE + 'lib/app/autoload/util.common.js',
+ Y = util.yuiuse({
'mojito-resource-store': BASE + 'lib/store.server.js'
});
View
46 lib/app/commands/build/yuiuse.js
@@ -1,46 +0,0 @@
-/*jslint node:true */
-'use strict';
-
-/**
- * some sugar for instantiating a Y object and attaching any YUI or Mojito (or
- * any other local) modules to it, with useSync == true. So instead of:
- *
- * var Y = YUI({useSync: true}).use('oop', ...);
- * Y.applyConfig({useSync: true, modules:{'mymodule1: ...}});
- * Y.use('mymodule1', ...);
- *
- * ...specify all modules and optional module configs in one go
- *
- * var Y = yuiuse({oop: null, mymodule1: 'path/to/it', foo: {base:...}, ...}
- *
- * @method yuiuse
- * @param {Object} modules A hash of module names. If value is falsey, YUI
- * will load it by name. If it's a string, it's the path of the module file to
- * load, otherwise assume it's a modules config
- * @param {String} some_particular_yui optional require() param to load YUI lib
- * from somewhere besides default modules.path
- * @param {Function} callback Optional for YUI().use(.. callback); Loading is
- * synchronous if omitted
- * @return {Object} yui instance
- */
-function yuiuse(modules, my_yui, callback) {
- var yui = require(my_yui || 'yui').YUI,
- names = Object.keys(modules || {}),
- local = {},
- y = yui({useSync: !callback});
-
- names.forEach(function (name) {
- var val = modules[name];
- if (val) {
- local[name] = typeof val === 'string' ? {fullpath: val} : val;
- }
- });
-
- y.applyConfig({modules: local});
- y.use(names);
- y.applyConfig({useSync: false});
-
- return callback ? callback(y) : y;
-}
-
-module.exports = yuiuse;
View
44 lib/management/utils.js
@@ -472,6 +472,50 @@ function contextCsvToObject(s) {
}
/**
+ * some sugar for instantiating a Y object and attaching any YUI or Mojito (or
+ * any other local) modules to it, with useSync == true. So instead of:
+ *
+ * var Y = YUI({useSync: true}).use('oop', ...);
+ * Y.applyConfig({useSync: true, modules:{'mymodule1: ...}});
+ * Y.use('mymodule1', ...);
+ *
+ * ...specify all modules and optional module configs in one go
+ *
+ * var Y = yuiuse({oop: null, mymodule1: 'path/to/it', foo: {base:...}, ...}
+ *
+ * @method yuiuse
+ * @param {Object} modules A hash of module names. If value is falsey, YUI
+ * will load it by name. If it's a string, it's the path of the module file to
+ * load, otherwise assume it's a modules config
+ * @param {String} some_particular_yui optional require() param to load YUI lib
+ * from somewhere besides default modules.path
+ * @param {Function} callback Optional for YUI().use(.. callback); Loading is
+ * synchronous if omitted
+ * @return {Object} yui instance
+ */
+function yuiuse(modules, my_yui, callback) {
+ var yui = require(my_yui || 'yui').YUI,
+ names = Object.keys(modules || {}),
+ local = {},
+ y = yui({useSync: !callback});
+
+ names.forEach(function (name) {
+ var val = modules[name];
+ if (val) {
+ local[name] = typeof val === 'string' ? {fullpath: val} : val;
+ }
+ });
+
+ y.applyConfig({modules: local});
+ y.use(names);
+ y.applyConfig({useSync: false});
+
+ return callback ? callback(y) : y;
+}
+
+exports.yuiuse = yuiuse;
+
+/**
*/
exports.process_directory = process_directory;
Please sign in to comment.
Something went wrong with that request. Please try again.