componentjs/builder2.js — pull request #81 by bogdan-dumitru (2014-09-26 11:44:51+00:00)
Title: Local dependencies in different paths with matching prefixes bug in new dependency lookup

> This bug was introduced by me with the nested components lookup changes #75

The test shows it pretty well but as a recap:

The top-level component has: two paths: ``lib1`` and ``lib2``.
- ``lib1`` contains the ``test`` component.
- ``lib2`` contains the ``test_again`` component.

The top-level component also defines ``test`` and ``test_again`` as local dependencies.

When the component requires ``test_again`` the lookup process finds ``test`` as local dependency that matches as a prefix of the require statement, and considers ``_again`` as the tail.

This is because we don't enforce the tail to be separate from the main component name by a slash.
---

By enforcing that slash to be part of the tail in the regexp and also making it optional and default to ``""`` (because now it can't match an empty string anymore because of the slash), we fix this problem and the test passes.