Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2b5285e

Browse filesBrowse files
committed
Merge pull request #168 from component/fix/local-paths
fix: inherit local paths
2 parents 3ec69dc + a4206b0 commit 2b5285e
Copy full SHA for 2b5285e

File tree

Expand file treeCollapse file tree

8 files changed

+33
-0
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+33
-0
lines changed

‎lib/resolver.js

Copy file name to clipboardExpand all lines: lib/resolver.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ Resolver.prototype.pull = function(type){
240240
*/
241241

242242
Resolver.prototype.resolve = function(dep, fn){
243+
this.locals = this.locals.concat(this.parent.locals);
243244
var paths = this.paths.concat(this.locals);
244245
var dep = dep.replace('/', '-');
245246
var name = this.conf.name;

‎test/fixtures/locals/app.js

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
module.exports = require('boot');

‎test/fixtures/locals/component.json

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "app",
3+
"main": "app.js",
4+
"paths": ["lib"],
5+
"scripts": ["app.js"],
6+
"local": ["boot"]
7+
}
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "a",
3+
"main": "index.js",
4+
"scripts": ["index.js"]
5+
}

‎test/fixtures/locals/lib/a/index.js

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
module.exports = 'a';
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "boot",
3+
"main": "index.js",
4+
"scripts": ["index.js"],
5+
"local": ["a"]
6+
}
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
module.exports = require('a');

‎test/resolver.js

Copy file name to clipboardExpand all lines: test/resolver.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ describe('Resolver', function(){
4141
})
4242
})
4343

44+
45+
describe('locals', function(){
46+
it('should work', function(done){
47+
var resolver = Resolver('test/fixtures/locals');
48+
resolver.end(done);
49+
})
50+
})
51+
4452
describe('collision', function(){
4553
it('should work', function(done){
4654
var collision = Resolver('test/fixtures/collision');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.