Permalink
Browse files

v1.2 - support nodejs

  • Loading branch information...
1 parent 17a1c26 commit 643c76d4d498fe1af96c7625068abcf949b35828 @dexteryy committed Feb 23, 2013
Showing with 161 additions and 32 deletions.
  1. +2 −0 .gitignore
  2. +115 −0 Gruntfile.js
  3. +1 −1 browsers.js
  4. +1 −1 key.js
  5. +5 −5 lang.js
  6. +2 −2 lang/mix.js
  7. +2 −2 lang/oop.js
  8. +2 −2 lang/struct.js
  9. +1 −1 lang/type.js
  10. +3 −2 mainloop.js
  11. +2 −2 network.js
  12. +1 −1 network/ajax.js
  13. +19 −8 package.json
  14. +3 −3 template.js
  15. +2 −2 template/micro.js
View
@@ -0,0 +1,2 @@
+node_modules/
+npmpackage/
View
@@ -0,0 +1,115 @@
+
+module.exports = function(grunt) {
+
+ grunt.initConfig({
+
+ pkg: grunt.file.readJSON('package.json'),
+ meta: {
+ publishDir: 'npmpackage'
+ },
+
+ furnace: {
+ npm: {
+ options: {
+ importas: 'amd',
+ exportas: 'cjs',
+ },
+ files: [{
+ expand: true, // Enable dynamic expansion.
+ cwd: './',
+ src: ['**/*.js', '!<%= meta.publishDir %>/**', '!node_modules/**', 'Gruntfile.js'], // Actual pattern(s) to match.
+ dest: '<%= meta.publishDir %>/', // Destination path prefix.
+ ext: '.js'
+ }]
+ }
+ },
+
+ copy: {
+ npm: {
+ files: [{
+ src: ['package.json', 'README.md'],
+ dest: '<%= meta.publishDir %>/'
+ }]
+ }
+ },
+
+ clean: {
+ publish: ['<%= meta.publishDir %>/']
+ },
+
+ shell: {
+ publish: {
+ command: 'npm publish',
+ options: {
+ stdout: true,
+ execOptions: {
+ cwd: '<%= meta.publishDir %>'
+ }
+ }
+ }
+ },
+
+ jshint: {
+ options: {
+ // Settings
+ "passfail": false, // Stop on first error.
+ // Env
+ "browser": true, // Standard browser globals e.g. `window`, `document`.
+ "nonstandard": true,
+ "node": true,
+ "globals": {
+ "ActiveXObject": true,
+ "require": true,
+ "define": true,
+ "module":true
+ },
+ // Development.
+ "devel": false, // Allow developments statements e.g. `console.log();`.
+ "debug": false, // Allow debugger statements e.g. browser breakpoints.
+ // ECMAScript 5.
+ "es5": true, // Allow ECMAScript 5 syntax.
+ "strict": false, // Require `use strict` pragma in every file.
+ "esnext": false, // tells JSHint that your code uses ES.next specific features such as const and let
+ // The Good Parts.
+ "eqeqeq": false, // prohibits the use of == and != in favor of === and !==
+ "eqnull": true, // Tolerate use of `== null`.
+ "immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
+ "noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
+ "undef": true, // Require all non-global variables be declared before they are used.
+ "unused": true, // warns when you define and never use your variables.
+ "trailing": false, // makes it an error to leave a trailing whitespace in your code
+ "boss": true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
+ "evil": true, // Tolerate use of `eval`.
+ "shadow": true, // suppresses warnings about variable shadowing i.e. declaring a variable that had been already declared somewhere in the outer scope.
+ "proto": true, // suppresses warnings about the __proto__ property
+ "validthis": true, // suppresses warnings about possible strict violations when the code is running in strict mode and you use this in a non-constructor function
+ // Personal styling preferences.
+ "indent": 4, // Specify indentation spacing
+ "asi": false, // suppresses warnings about missing semicolons
+ "laxbreak": true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
+ "laxcomma": true, // suppresses warnings about comma-first coding style
+ "curly": false, // Require {} for every new block or scope.
+ "nonew": true, // Prohibit use of constructors for side-effects.
+ "sub": true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
+ "loopfunc": true, // suppresses warnings about functions inside of loops.
+ "regexdash": true, // suppresses warnings about unescaped - in the end of regular expressions
+ "white": false, // Check against strict whitespace and indentation rules.
+ "scripturl": true, // Tolerate script-targeted URLs.
+ "multistr": true // suppresses warnings about multi-line strings
+ },
+ main: ['**/*.js', '!<%= meta.publishDir %>/**', '!node_modules/**']
+ }
+
+ });
+
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-copy');
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-furnace');
+ grunt.loadNpmTasks('grunt-shell');
+
+ grunt.registerTask('default', ['jshint', 'clean:publish', 'furnace', 'copy']);
+ grunt.registerTask('publish', ['default', 'shell:publish']);
+
+};
+
View
@@ -22,7 +22,7 @@ define("mo/browsers", [], function(){
};
try {
- var ua = navigator.userAgent.toLowerCase(),
+ var ua = this.navigator.userAgent.toLowerCase(),
rmobilesafari = /apple.*mobile.*safari/,
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
View
2 key.js
@@ -8,7 +8,7 @@
* Copyright (C) 2010-2012, Dexter.Yy, MIT License
* vim: et:ts=4:sw=4:sts=4
*/
-define("mo/key", ["jquery", "mo/lang"], function($, _){
+define("mo/key", ["jquery", "./lang"], function($, _){
var specialKeys = {
8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
View
10 lang.js
@@ -8,11 +8,11 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/lang", [
- "mo/lang/es5",
- "mo/lang/type",
- "mo/lang/mix",
- "mo/lang/struct",
- "mo/lang/oop"
+ "./lang/es5",
+ "./lang/type",
+ "./lang/mix",
+ "./lang/struct",
+ "./lang/oop"
], function(es5, detect, _, struct, oo, require, exports){
var host = this,
View
@@ -6,8 +6,8 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/lang/mix", [
- "mo/lang/es5",
- "mo/lang/type"
+ "./es5",
+ "./type"
], function(_0, _, require, exports){
var type = _.type;
View
@@ -6,8 +6,8 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/lang/oop", [
- "mo/lang/es5",
- "mo/lang/mix"
+ "./es5",
+ "./mix"
], function(es5, _, require, exports){
var mix = _.mix;
View
@@ -6,8 +6,8 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/lang/struct", [
- "mo/lang/es5",
- "mo/lang/mix"
+ "./es5",
+ "./mix"
], function(_0, _, require, exports){
var mix = _.mix;
View
@@ -6,7 +6,7 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/lang/type", [
- "mo/lang/es5"
+ "./es5"
], function(_0, require, exports){
var _toString = Object.prototype.toString,
View
@@ -8,9 +8,10 @@
* Copyright (C) 2010-2012, Dexter.Yy, MIT License
* vim: et:ts=4:sw=4:sts=4
*/
-define("mo/mainloop", ["mo/lang"], function(_){
+define("mo/mainloop", ["./lang"], function(_){
- var ANIMATE_FRAME = "RequestAnimationFrame",
+ var window = this,
+ ANIMATE_FRAME = "RequestAnimationFrame",
LONG_AFTER = 4000000000000,
animateFrame = window['webkit' + ANIMATE_FRAME] ||
View
@@ -8,8 +8,8 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/network", [
- "mo/lang",
- "mo/network/ajax"
+ "./lang",
+ "./network/ajax"
], function(_, net, require, exports){
var window = this,
View
@@ -6,7 +6,7 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/network/ajax", [
- "mo/browsers"
+ "../browsers"
], function(browsers, require, exports){
var httpParam = function(a) {
View
@@ -1,7 +1,7 @@
{
- "name": "Mo",
+ "name": "mo",
"description": "A collection of OzJS core modules that form a library called \"Mo\"",
- "homepage": "https://github.com/dexteryy/mo",
+ "homepage": "http://ozjs.org/mo",
"author": {
"name": "dexteryy",
"email": "dexter.yy@gmail.com",
@@ -15,13 +15,24 @@
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}],
+ "version": "1.2.0",
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "devDependencies": {
+ "grunt-shell": "~0.2.1",
+ "grunt-furnace": "~0.1.0",
+ "grunt-contrib-clean": "~0.4.0",
+ "grunt-contrib-copy": "~0.4.0",
+ "grunt-contrib-jshint": "~0.1.1",
+ "grunt": "~0.4.0"
+ },
+ "dependencies": {
+
+ },
"keywords" : [
- "AMD",
+ "utility",
"oz",
"ozjs"
- ],
- "version": "1.1.2",
- "dependencies": {
-
- }
+ ]
}
View
@@ -8,9 +8,9 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/template", [
- "mo/lang",
- "mo/template/string",
- "mo/template/micro"
+ "./lang",
+ "./template/string",
+ "./template/micro"
], function(_, stpl, microtpl, require, exports){
_.mix(exports, stpl, microtpl);
View
@@ -6,8 +6,8 @@
* vim: et:ts=4:sw=4:sts=4
*/
define("mo/template/micro", [
- "mo/lang",
- "mo/template/string"
+ "../lang",
+ "./string"
], function(_, stpl, require, exports){
var document = this.document;

0 comments on commit 643c76d

Please sign in to comment.