BladeRunnerJS / brjs

BladeRunnerJS (BRJS) is an open source development toolkit and framework for modular construction of large single-page HTML5 apps. It consists of a set of conventions, supporting tools and micro-libraries that make it easy to develop, test, deploy and maintain complex JavaScript apps.

Home Page:http://bladerunnerjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

requirePrefix in br-lib.conf can't contain hyphens

germtb opened this issue · comments

I had a quick look and the problem seems to be in the regex that matches the require prefix.

This is by design. If 'namespacedjs' style code is in the bundle we have to globalise all require paths, e.g foo/bar/MyClass becomes foo.bar.MyClass. So require paths must not contain invalid characters.

I think this may also cause a problem for NPM support. Please see the second conundrum in #1611.

We could support this by breaking the 'namespaced paths are largely the same as the equivalent require path' that we have at the moment. e.g. foo/bar/MyClass -> foo.br.MyClass which is a simple conversion. We'd need to translate all invalid characters (-/+/@ etc) to valid characters (possibly _). We'd need to be careful that we don't convert require paths and then end up with ambiguous paths, for example @foo/MyClass and +foo/MyClass would both become _foo.MyClass even though they are separate CommonJS modules.

We'd need to be careful that we don't convert require paths and then end up with ambiguous paths, for example @foo/MyClass and +foo/MyClass would both become _foo.MyClass even though they are separate CommonJS modules.

One way to deal with this would be to convert @ to _$at_ and + to _$plus_. This could be done by using Java's built-in Character.getName() method to give us the name of any characters we can't support.

Since this was done by design and it is no longer a problem, I am closing this issue.