Skip to content

Commit

Permalink
move extraDeps to transport #8
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Jul 9, 2014
1 parent 8ae4555 commit 862fbe3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

---

## 1.0.0

- move extraDeps to transport

## 0.7.3

upgrade searequire@1.3.0
Expand Down
9 changes: 0 additions & 9 deletions lib/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ var debug = require('debug')('father:package');
var util = require('./util');

var defaults = {
// config an extension as key, when that extension is found,
// value will be added to deps
extraDeps: {},

// another entry point for parse
entry: [],

Expand Down Expand Up @@ -171,11 +167,6 @@ var Package = Class.create({
files[src] = {};
}

// extension in extraDeps will be added to deps
// E.g. a.handlebars should require `handlebars`
var extraDeps = options.extraDeps;
if (extraDeps[ext]) deps.push(extraDeps[ext]);

// file dependencies
var data = fs.readFileSync(join(dest, src)).toString();
var fileDeps = getFileDeps(data, ext, options)
Expand Down
6 changes: 3 additions & 3 deletions test/spm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ var should = require('should');
describe('Father.SpmPackage', function() {

it('normal', function() {
var pkg = getPackage('normal', {extraDeps: {handlebars: 'handlebars'}});
var pkg = getPackage('normal');
pkg.output.should.eql(['c.js']);
should.exists(pkg.files['c.js']);
var pkgDeps = pkg.dependencies;
var pkgDevDeps = pkg.devDependencies;
pkg.main.should.eql('a.js');
pkg.name.should.eql('a');
pkg.version.should.eql('1.0.0');
pkg.files['a.js'].dependencies.should.eql(['b', './b.js', 'd', './a.json', './a.handlebars', 'c', 'handlebars']);
pkg.files['a.js'].dependencies.should.eql(['b', './b.js', 'd', './a.json', './a.handlebars', 'c']);
pkg.files['b.js'].dependencies.should.eql(['b', 'c']);
pkgDeps['b'].should.eql(pkg.get('b@1.1.0'));
pkgDeps['c'].should.eql(pkg.get('c@1.1.1'));
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('Father.SpmPackage', function() {
bPkg.files['src/c.css'].dependencies.should.eql([]);
});

it('pass extraDeps', function() {
xit('pass extraDeps', function() {
var pkg = getPackage('pass-extradeps', {extraDeps: {handlebars: 'handlebars'}});
var bPkg = pkg.dependencies.b;
bPkg.files['index.js'].dependencies.should.eql(['./b.handlebars', 'handlebars']);
Expand Down

0 comments on commit 862fbe3

Please sign in to comment.