Support accessing a property of a library as a namespace itself

Description

ClojureScript uses Google Closure conventions which is a relatively disciplined way to explicitly describe the library structure. In some sense `goog.provide` is a tag identifying which parts of a JavaScript object are being used as a namespace abstraction. However foreign JavaScript libraries do not really declare the structure of the library structure they export. ES6 export provides more discipline, but this represents only a portion of the cases we'll like to address.

In Clojure due to JVM munging, static inner classes in package use the `$` delimiter. ClojureScript itself adopted this convention for `foo$macros`. We could adopt a similar convention here.

This also gives us an idiomatic way to deal with `default` exports:

We don’t need to be too concerned about clashes - we can first check that the original thing exists. If not remove the suffix and check for the prefix.

There are common cases where nested access is necessary. For example React Native native modules. After the first $ we can return to . (suggested by Thomas Heller).

Environment

None

Assignee

David Nolen

Reporter

David Nolen

Labels

None

Approval

Vetted

Patch

None

Priority

Blocker
Configure