public
Last active — forked from caridy/m.js

  • Download Gist
.gitignore
1
node_modules
lib/m.js
JavaScript
1 2 3 4 5
YUI.add('mojito', function(Y, NAME) {
 
Y.namespace('mojito');
 
}, '0.1.0', {requires: []});
lib/s.js
JavaScript
1 2 3 4 5 6 7 8 9
YUI.add('mojito-resource-store', function(Y, NAME) {
 
Y.mojito.ResourceStore = 'You have a winner!';
 
}, '0.0.1', { requires: [
'base',
'oop',
'mojito-util'
]});
lib/test.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
var libpath = require('path'),
YUIFactory = require('./yui-sandbox.js'),
YUI = YUIFactory.getYUI();
 
var Z = require('yui').YUI({
useSync: true,
modules: {
'mojito': {
fullpath: libpath.join(__dirname, 'm.js')
},
'mojito-util': {
fullpath: libpath.join(__dirname, 'u.js')
},
'mojito-resource-store': {
fullpath: libpath.join(__dirname, 's.js')
}
}
});
Z.use('mojito-resource-store');
console.log('yui: ', Z.mojito.ResourceStore);
 
var Y = YUI({
useSync: true,
modules: {
'mojito': {
fullpath: libpath.join(__dirname, 'm.js')
},
'mojito-util': {
fullpath: libpath.join(__dirname, 'u.js')
},
'mojito-resource-store': {
fullpath: libpath.join(__dirname, 's.js')
}
}
});
Y.use('mojito-resource-store');
console.log('sandbox: ', Y.mojito && Y.mojito.ResourceStore);
lib/u.js
JavaScript
1 2 3 4 5 6 7 8 9
YUI.add('mojito-util', function(Y) {
 
Y.mojito.util = {};
 
}, '0.1.0', {requires: [
'array-extras',
'json-stringify',
'mojito'
]});
lib/yui-sandbox.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*jslint nomen:true, sloppy: true, stupid: true, node: true*/
 
var fs = require('fs'),
path = require('path'),
vm = require('vm'),
file = path.join(__dirname, '..', 'node_modules', 'yui', 'yui-nodejs', 'yui-nodejs.js'),
code = fs.readFileSync(file, 'utf8');
 
exports.getYUI = function () {
var sandbox = {
console: console,
process: process,
require: require,
module: module,
setTimeout: setTimeout,
setInterval: setInterval,
__filename: __filename,
__dirname: path.join(__dirname, '..', 'node_modules', 'yui', 'yui-nodejs'),
exports: {}
};
vm.runInNewContext(code, sandbox, 'build/yui-new/yui-new.js');
return sandbox.exports.YUI;
};
package.json
JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
{
"name": "mojito",
"version": "0.5.0pr1",
"description": "Mojito provides an architecture, components and tools for developers to build complex web applications faster.",
"preferGlobal": true,
"author": "Drew Folta <folta@yahoo-inc.com>",
"contributors": [
"Ric Allinson <allinson@yahoo-inc.com>",
"Matt Taylor <mtaylor@yahoo-inc.com>",
"Chris Klaiber <cklaiber@yahoo-inc.com>",
"Drew Folta <folta@yahoo-inc.com>",
"Martin Cooper <mcooper@yahoo-inc.com>",
"Isao Yagi <isao@yahoo-inc.com>",
"Michael Ridgway <mridgway@yahoo-inc.com>",
"Caridy Patino <caridy@yahoo-inc.com>"
],
"dependencies": {
"yui": "~3.7.2",
"request": "2.9.202"
},
"keywords": [
"framework",
"webapp"
],
"main": "lib/mojito",
"directories": [
"bin",
"docs",
"lib"
],
"bin": {
"mojito": "bin/mojito"
},
"engines": {
"node": ">0.4",
"npm": ">1.0"
},
"homepage": "http://developer.yahoo.com/cocktails/mojito/",
"repository": {
"type": "git",
"url": "git://github.com/yahoo/mojito.git"
},
"bugs": "https://github.com/yahoo/mojito/issues",
"scripts": {
"test": "./tests/run.js test -u --group server --driver nodejs && ./tests/run.js test -u --group client --driver selenium"
},
"yahoo": {
"mojito": {
"type": "bundle",
"location": "lib/app"
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.