Skip to content

Commit

Permalink
support scoped modules containing hyphens
Browse files Browse the repository at this point in the history
  • Loading branch information
rosswarren committed Mar 4, 2017
1 parent 98e7048 commit 4d03274
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
### Fixed
- attempt to fix crash in [`no-mutable-exports`]. ([#660])
- "default is a reserved keyword" in no-maned-default tests by locking down babylon to 6.15.0 (#756, thanks @gmathieu)
- support scoped modules containing non word characters


## [2.2.0] - 2016-11-07
Expand Down
2 changes: 1 addition & 1 deletion src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function isExternalModule(name, settings, path) {
return externalModuleRegExp.test(name) && isExternalPath(path, name, settings)
}

const scopedRegExp = /^@\w+\/\w+/
const scopedRegExp = /^@[^\/]+\/[^\/]+/
function isScoped(name) {
return scopedRegExp.test(name)
}
Expand Down
3 changes: 3 additions & 0 deletions tests/src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ describe('importType(name)', function () {
it("should return 'external' for scopes packages", function() {
expect(importType('@cycle/core', context)).to.equal('external')
expect(importType('@cycle/dom', context)).to.equal('external')
expect(importType('@some-thing/something', context)).to.equal('external')
expect(importType('@some-thing/something/some-module', context)).to.equal('external')
expect(importType('@some-thing/something/some-directory/someModule.js', context)).to.equal('external')
})

it("should return 'internal' for non-builtins resolved outside of node_modules", function () {
Expand Down

0 comments on commit 4d03274

Please sign in to comment.