jsx/JSX — pull request #275 by shibukawa (2013-10-03 09:42:37+00:00)
Title: Add npm packaging support to js/node platform

Search folders consists of:

1. `--add-search-path` items
2. `[parent]` folder of source file
3. `[ancestor folders]/node_modules` folder until root folder **[it's new!]**
4. `platform.getRoot() + "/lib/js"`

Search Algorithm:

1. If `givenPath` is not started with `'.'`:
1. Loop in search folders:
1. Return `[search path]/ + givenPath` if exists and is a file.
2. If `givenPath` is a directory name and `[search path] + givenPath` exists:
1. Return `[search path] + givenPath + /index.jsx` if exists **[it's new!]**
2. Read `[search path] + givenPath + /package.json`
1. Return `[search path] + givenPath + json['main']` if `json['main']` exists **[it's new!]**
3. If `givenPath`'s first part is directory name and `[search path] + givenPath[0] + /package.json` exists:
1. Return `[search path] + givenPath[0] + json['directories']['lib'] + givenPath[1...]` if exists**[it's new!]**
2. Returns `[parent] + gevenPath`;