Skip to content

Commit

Permalink
feat(file): filename should be case sensitive on crose-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Jan 30, 2015
1 parent 9f611c6 commit 0de1def
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var fs = require('fs');
var path = require('path');
var Vinyl = require('vinyl');
var exists = require('exists-case').sync;
var join = path.join;
var relative = path.relative;
var extname = path.extname;
Expand Down Expand Up @@ -146,8 +147,7 @@ function tryFile(src, cwd) {
for (var i in fileArray) {
var file = join(cwd, fileArray[i]);
try {
var stat = fs.statSync(file);
if (stat.isFile()) {
if (exists(file) && fs.statSync(file).isFile()) {
return fileArray[i];
}
} catch(e) {}
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"main": "index",
"dependencies": {
"arale": "~0.2.0",
"crequire": "~1.5.0",
"css-imports": "~0.3.0",
"debug": "~1.0.2",
"exists-case": "~0.1.0",
"extend": "~1.3.0",
"glob": "~4.0.2",
"crequire": "~1.5.0",
"mixarg": "~0.2.0",
"semver": "~2.3.1",
"extend": "~1.3.0",
"vinyl": "~0.4.6",
"mixarg": "~0.2.0"
"vinyl": "~0.4.6"
},
"devDependencies": {
"coveralls": "~2.8.0",
Expand All @@ -32,4 +33,4 @@
"scripts": {
"test": "make test"
}
}
}
Empty file.
1 change: 1 addition & 0 deletions test/fixtures/spm/case-sensitive/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./a.js');
4 changes: 4 additions & 0 deletions test/fixtures/spm/case-sensitive/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "case-sensitive",
"version": "1.0.0"
}
6 changes: 6 additions & 0 deletions test/spm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,12 @@ describe('Father.SpmPackage', function() {
getPackage('recursive');
}).should.throw('found test/fixtures/spm/recursive/index.js has recursive dependency');
});

it('should require file case sensitive', function() {
(function() {
getPackage('case-sensitive');
}).should.throw('test/fixtures/spm/case-sensitive/a.js not found that required by test/fixtures/spm/case-sensitive/index.js');
});
});
});

Expand Down

0 comments on commit 0de1def

Please sign in to comment.