component-builder
Advanced tools
Comparing version 0.8.3 to 0.9.0
0.9.0 / 2013-07-19 | ||
================== | ||
* add support for building templates as strings | ||
* add css transpiler example | ||
* replace `fs-extra` with `cp` | ||
* change Function()-evaled code to actually include newlines | ||
* fix absolute path lookup problem #91 | ||
0.8.3 / 2013-06-06 | ||
@@ -3,0 +12,0 @@ ================== |
@@ -6,5 +6,6 @@ /** | ||
var fs = require('fs') | ||
, cp = require('fs-extra').copy | ||
, cp = require('cp') | ||
, path = require('path') | ||
, join = path.join | ||
, resolve = path.resolve | ||
, dirname = path.dirname | ||
@@ -20,3 +21,4 @@ , Batch = require('batch') | ||
, dirname = path.dirname | ||
, basename = path.basename; | ||
, basename = path.basename | ||
, strtojs = require('string-to-js'); | ||
@@ -55,3 +57,4 @@ /** | ||
images: [], | ||
fonts: [] | ||
fonts: [], | ||
templates: [] | ||
}; | ||
@@ -234,3 +237,3 @@ | ||
} else { | ||
this.addLookup(join(this.dir, path)); | ||
this.addLookup(resolve(this.dir, path)); | ||
} | ||
@@ -253,3 +256,3 @@ | ||
} else { | ||
this.lookupPaths.push(join(this.dir, path)); | ||
this.lookupPaths.push(resolve(this.dir, path)); | ||
} | ||
@@ -461,2 +464,3 @@ | ||
batch.push(this.buildScripts.bind(this)); | ||
batch.push(this.buildTemplates.bind(this)); | ||
batch.push(this.buildAliases.bind(this)); | ||
@@ -469,4 +473,11 @@ batch.push(this.buildStyles.bind(this)); | ||
if (err) return fn(err); | ||
var scripts = res.shift(); | ||
var require = res.shift(); | ||
var templates = res.shift(); | ||
var custom = self._js; | ||
var js = [scripts, require, templates, custom].filter(empty).join('\n') | ||
fn(null, { | ||
js: res.shift() + '\n' + res.shift() + '\n' + self._js, | ||
js: js, | ||
css: res.shift(), | ||
@@ -565,7 +576,7 @@ images: res.shift(), | ||
aliases = aliases.join(''); | ||
aliases = aliases.join('\n'); | ||
builder.buildAliases(function(err, str){ | ||
if (err) return done(err); | ||
done(null, aliases + str); | ||
done(null, aliases + '\n' + str); | ||
}); | ||
@@ -605,3 +616,3 @@ }); | ||
return 'require.alias("' + name + '/' + b + '", "' + a + '");\n'; | ||
return 'require.alias("' + name + '/' + b + '", "' + a + '");'; | ||
}; | ||
@@ -819,2 +830,15 @@ | ||
/** | ||
* Build templates and invoke `fn(err, str)` | ||
* | ||
* @param {Function} fn | ||
* @api private | ||
*/ | ||
Builder.prototype.buildTemplates = function(fn){ | ||
this.buildType('templates', fn, function(builder, file, str){ | ||
return register(builder, file, strtojs(str)); | ||
}); | ||
}; | ||
/** | ||
* Build styles and invoke `fn(err, css)`. | ||
@@ -921,4 +945,6 @@ * | ||
if (builder.sourceUrls) { | ||
js = JSON.stringify(js + '//@ sourceURL=' + file); | ||
js = js.replace(/\\n/g, '\\n\\\n'); | ||
return 'require.register("' + file + '", Function("exports, require, module",\n' | ||
+ JSON.stringify(js + '//@ sourceURL=' + file) | ||
+ js | ||
+ '\n));'; | ||
@@ -925,0 +951,0 @@ } else { |
{ | ||
"name": "component-builder", | ||
"version": "0.8.3", | ||
"version": "0.9.0", | ||
"description": "Component build tool", | ||
@@ -16,3 +16,4 @@ "keywords": [ | ||
"better-assert": "~0.1.0", | ||
"fs-extra": "~0.6.0" | ||
"cp": "~0.1.0", | ||
"string-to-js": "0.0.1" | ||
}, | ||
@@ -22,3 +23,4 @@ "devDependencies": { | ||
"should": "*", | ||
"ejs": "~0.8.3" | ||
"ejs": "~0.8.3", | ||
"styl": "0.2.2" | ||
}, | ||
@@ -25,0 +27,0 @@ "repository": { |
@@ -65,3 +65,3 @@ # builder.js | ||
## Hooks | ||
### Builder#hook(name, fn) | ||
@@ -72,2 +72,6 @@ A build "hook" is like an event that lets you manipulate the build in process. For | ||
CSS pre-processors such as [rework](https://github.com/visionmedia/rework). | ||
Available hooks are: | ||
- `before scripts` | ||
- `before styles` | ||
@@ -74,0 +78,0 @@ ## Examples |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
29527
887
115
7
4
+ Addedcp@~0.1.0
+ Addedstring-to-js@0.0.1
+ Addedcp@0.1.1(transitive)
+ Addedstring-to-js@0.0.1(transitive)
- Removedfs-extra@~0.6.0
- Removedfs-extra@0.6.4(transitive)
- Removedjsonfile@1.0.1(transitive)
- Removedncp@0.4.2(transitive)
- Removedrimraf@2.2.8(transitive)