Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build dependencies for AMD style modules before linting #29

Open
1 task
Robbert opened this issue May 9, 2016 · 2 comments
Open
1 task

Build dependencies for AMD style modules before linting #29

Robbert opened this issue May 9, 2016 · 2 comments
Assignees

Comments

@Robbert
Copy link
Member

Robbert commented May 9, 2016

The only module currently in the repository is URI.js, which has no dependencies. New modules, that are likely to have dependencies, will fail linting (especially for the Closure Compiler) because of undefined dependencies. Before we can continue adding modules we need to be able to build the dependencies.

  • Give the --transform_amd_modules flag for the Closure Compiler another try. Malte Ubl wrote this plugin in December 2011, not sure how much work has been done since...
@Robbert Robbert self-assigned this May 11, 2016
@Yolijn
Copy link
Collaborator

Yolijn commented May 12, 2016

We could build one big js file based on the current module and all dependencies, downside would be that any warning or error would reference the code line in the combined file, not the actual file.

Ideally we would use the AMD option of Closure Compiler to load all dependencies of the tested module, but so far we have not been able to use this successfully. Other people seem to be able to though....

Another option would be to build the AMD modules with RequireJS for example, and build source maps too, and convert the line number/column locations of any warnings from the Closure Compiler output back to the original files.

@Robbert
Copy link
Member Author

Robbert commented May 25, 2016

I have tried using r.js to build the AMD modules. It is an addition to require.js to build modules in different non-browser environments. The reason there is no default Gulp plugin is rumored to be that r.js does all the filesystem handling itself, and is hard to combine with streaming build systems like Gulp.

So, how hard can it be to extend r.js to support this use case? I am quite put off to this dirty work, because the code is really gross. The Node.js implementation can be found in a file called [x.js], which I don't seem to be able to find in any git repo anymore.

So I dropped the require.js approach in favour of using an old build of my own AMD loader implementation. This worked great, although it required one workaround: create a new Loader instance for every file.

Now that we have a stream for every .js file in the src/ directory, the next step is building every compiled AMD module with Closure Compiler. The google-closure-compiler package should do this, however it appears to aggregate all streams and build them as one. Now I need to tweak the package to have an option to build every file separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants