Comparing version 0.7.5 to 0.7.6
@@ -12,43 +12,40 @@ /* | ||
gear = require(path.join(process.cwd(), 'index')), | ||
handlebars = require('./node_modules/gear-lib/node_modules/handlebars'); | ||
handlebars = require('./node_modules/gear-lib/node_modules/handlebars'), | ||
wrap = handlebars.compile( | ||
"\n\ndefine('{{name}}', ['require', 'exports'{{#modules}}, '{{.}}'{{/modules}}], function(require, exports{{#input}}, {{.}}{{/input}}) {\n\n" + | ||
"{{{result}}}\n\n" + | ||
"});\n\n" | ||
), | ||
helper = handlebars.compile( | ||
"define('../blob', ['require', 'exports', 'blob'], function(require, exports, blob) {\n" + | ||
"exports.Blob = blob.Blob;\n" + | ||
"});\n\n" + | ||
"define('./default_tasks', ['require', 'exports'{{#tasks}}, '{{.}}'{{/tasks}}], function(require, exports) {\n" + | ||
"var tasks = [];\n" + | ||
"{{#tasks}}tasks.push(require('{{.}}'));{{/tasks}}\n" + | ||
"tasks.forEach(function(mod) {for (var task in mod) {exports[task] = mod[task];}});\n" + | ||
"});\n\n" + | ||
"define('gear', ['require', 'exports', 'blob', 'registry', 'queue'], function(require, exports, blob, registry, queue) {\n" + | ||
"exports.Blob = blob.Blob; exports.Registry = registry.Registry; exports.Queue = queue.Queue;\n" + | ||
"});\n\n" | ||
), | ||
files = { | ||
'vendor/require.js': {}, | ||
'node_modules/async/lib/async.js': {name: 'async', modules: ['module'], input: ['module']}, | ||
'lib/blob.js': {name: './blob'}, | ||
'lib/tasks/concat.js': {name: './tasks/concat', task: true}, | ||
'lib/tasks/core.js': {name: './tasks/core', modules: ['../blob'], task: true}, | ||
'lib/tasks/read.js': {name: './tasks/read', modules: ['../blob'], task: true}, | ||
'lib/tasks/write.js': {name: './tasks/write', task: true}, | ||
'lib/tasks/tasks.js': {name: './tasks/tasks', modules: ['async'], task: true}, | ||
'lib/registry.js': {name: './registry', modules: ['./tasks/concat', './default_tasks']}, | ||
'lib/queue.js': {name: './queue', modules: ['async', './registry', './blob']} | ||
}, | ||
tasks = []; | ||
var wrap = handlebars.compile( | ||
"\n\ndefine('{{name}}', ['require', 'exports'{{#modules}}, '{{.}}'{{/modules}}], function(require, exports{{#input}}, {{.}}{{/input}}) {\n\n" + | ||
"{{{result}}}\n\n" + | ||
"});\n\n" | ||
); | ||
for (var key in files) {if (files[key].task) {tasks.push(files[key].name);}} | ||
var helper = handlebars.compile( | ||
"define('../blob', ['require', 'exports', 'blob'], function(require, exports, blob) {\n" + | ||
"exports.Blob = blob.Blob;\n" + | ||
"});\n\n" + | ||
"define('./default_tasks', ['require', 'exports'{{#tasks}}, '{{.}}'{{/tasks}}], function(require, exports) {\n" + | ||
"var tasks = [];\n" + | ||
"{{#tasks}}tasks.push(require('{{.}}'));{{/tasks}}\n" + | ||
"tasks.forEach(function(mod) {for (var task in mod) {exports[task] = mod[task];}});\n" + | ||
"});\n\n" | ||
); | ||
var files = { | ||
'vendor/require.js': {}, | ||
'node_modules/async/lib/async.js': {name: 'async', modules: ['module'], input: ['module']}, | ||
'lib/blob.js': {name: './blob'}, | ||
'lib/tasks/concat.js': {name: './tasks/concat', task: true}, | ||
'lib/tasks/core.js': {name: './tasks/core', modules: ['../blob'], task: true}, | ||
'lib/tasks/read.js': {name: './tasks/read', modules: ['../blob'], task: true}, | ||
'lib/tasks/write.js': {name: './tasks/write', task: true}, | ||
'lib/tasks/tasks.js': {name: './tasks/tasks', modules: ['async'], task: true}, | ||
'lib/registry.js': {name: './registry', modules: ['./tasks/concat', './default_tasks']}, | ||
'lib/queue.js': {name: './queue', modules: ['async', './registry', './blob']} | ||
}; | ||
var tasks = []; | ||
for (var task in files) { | ||
if (files[task].task) { | ||
tasks.push(files[task].name); | ||
} | ||
} | ||
new gear.Queue({registry: new gear.Registry({module: 'gear-lib'})}) | ||
.read(Object.keys(files)) | ||
.load(helper({tasks: tasks})) | ||
.jslint({nomen: true, sloppy: true, white: true, vars: true, callback: function(blob) { | ||
@@ -58,7 +55,6 @@ //console.log(blob.name ? blob.name : 'inline', blob.jslint); | ||
.concat({callback: function(blob) { | ||
var obj = files[blob.name]; | ||
if (obj.name) { | ||
var vars = {result: blob.result, modules: []}; | ||
if (blob.name in files && files[blob.name].name) { | ||
var obj = files[blob.name]; | ||
var vars = {result: blob.result}; | ||
Object.keys(obj).forEach(function(attr) {vars[attr] = obj[attr];}); | ||
//Object.keys(vars.modules).forEach(function(attr) {vars.paths[attr] = obj[attr];}); | ||
return wrap(vars); | ||
@@ -68,18 +64,7 @@ } | ||
}}) | ||
.load(helper({tasks: tasks})) | ||
.concat() | ||
.tasks({ | ||
dev: {task: ['write', 'build/gear.js']} | ||
/* | ||
fullraw: {task: ['read', 'node_modules/gear-lib/build/gear-lib.js']}, | ||
full: {requires: 'fullraw', task: 'concat'}, | ||
devfull: {requires: 'full', task: ['write', 'build/gear-full.js']}, | ||
prodfullmin: {requires: 'full', task: 'jsminify'}, | ||
prodfull: {requires: 'prodfullmin', task: ['write', 'build/gear-full.min.js']}, | ||
dev: {task: ['write', 'build/gear.js']}, | ||
prodmin: {task: 'jsminify'}, | ||
prod: {requires: 'prodmin', task: ['write', 'build/gear.min.js']}, | ||
join: {requires: ['dev', 'devfull', 'prod', 'prodfull']} | ||
*/ | ||
join: {requires: ['dev', 'prod']} | ||
}) | ||
@@ -86,0 +71,0 @@ .run(function(err, results) { |
@@ -66,2 +66,6 @@ /* | ||
_loadDir: function(dirname) { | ||
if (!path.existsSync(dirname)) { | ||
throw new Error('Directory ' + dirname + ' doesn\'t exist'); | ||
} | ||
var fs = require('fs'), | ||
@@ -71,6 +75,2 @@ files = fs.readdirSync(dirname), | ||
if (!path.existsSync(dirname)) { | ||
throw new Error('Directory ' + dirname + ' doesn\'t exist'); | ||
} | ||
files.forEach(function(filename) { | ||
@@ -77,0 +77,0 @@ self._loadFile(path.join(dirname, filename)); |
{ | ||
"name": "gear", | ||
"version": "0.7.5", | ||
"version": "0.7.6", | ||
"description": "Gear.js - Task-based build system.", | ||
@@ -5,0 +5,0 @@ "author": "Stephen Murphy <stephen@hypernaut.com>", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
108691
2475