ClojureScript

Improve error reporting when converting JavaScript modules

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: GSoC
  • Fix Version/s: GSoC
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

When using the Google Closure compiler via the command line and trying to convert a JavaScript module which has trailing commas, the compiler throws a parse error, e.g.:

chance.js:1109: ERROR - Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set the appropriate language_in option.
                        '09' + self.string({ pool: '0123456789', length: 8}),

At the moment, we don't throw any errors when converting a module and an error occurs. Instead, just the following gets emitted by the Google Closure compiler:

goog.provide("module$libs$chance");var module$libs$chance={}

We need to change this behaviour to show the warnings and errors the Google Closure compiler is emitting.

Activity

Hide
Kristian Mandrup added a comment -

Yes, by default don't convert the CommonJS module, unless perhaps if you set a specific --force compile option.

Show
Kristian Mandrup added a comment - Yes, by default don't convert the CommonJS module, unless perhaps if you set a specific --force compile option.
Hide
Maria Geller added a comment -

Show Google Closure compiler warnings when converting JS modules and set :closure-warnings, :closure-extra-annotations and :pretty-print options. We cannot use the make-options functions for this, since it requires an optimizations level. Instead pull options that we want to use into set-options function.

Show
Maria Geller added a comment - Show Google Closure compiler warnings when converting JS modules and set :closure-warnings, :closure-extra-annotations and :pretty-print options. We cannot use the make-options functions for this, since it requires an optimizations level. Instead pull options that we want to use into set-options function.

People

Vote (2)
Watch (2)

Dates

  • Due:
    Created:
    Updated:
    Resolved: