There’s a number of different classes of errors I’m getting.
Some I believe to be blockers:
Redeclared variable
constant fs assigned a value more than once
variable XML is undeclared
variable Buffer is undeclared
WARNING: externs/assert.js:142: WARNING - accessing name assert in externs has
no effect. Perhaps you forgot to add a var keyword?
module.exports = assert;
Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: externs/child_process.js:23: WARNING - Variable events first declared
in externs/net.js
var events = require('events');
^
Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: externs/child_process.js:23: WARNING - accessing name require in
externs has no effect. Perhaps you forgot to add a var keyword?
var events = require('events');
Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: externs/child_process.js:114: WARNING - name module is not defined in
the externs.
module.exports = child_process;
^
Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: externs/child_process.js:114: WARNING - accessing name child_process
in externs has no effect. Perhaps you forgot to add a var keyword?
module.exports = child_process;
^
On Nov 22, 2016, at 11:09 PM, Josh Tynjala <[email protected]> wrote:
> Yes, I probably should have made those automatically generated require()
> calls work similarly to "internal" classes that appear after the package
> block, where they end up being stored statically on the class in the
> generated JS instead of globally. The redeclared variable warnings should
> be safe to ignore, though.
>
> - Josh
>
> On Tue, Nov 22, 2016 at 12:59 PM, Harbs <[email protected]> wrote:
>
>> I’m now on to the next issue:
>>
>> I’m getting lots of errors like this:
>> (and by lots, I mean 1300 lines worth of output)
>>
>> I have lots of Node.js code in my project and all the require() statements
>> are output automatically.
>>
>> It seems to me that the variable declarations should be scoped to the file
>> (or something).
>>
>> Buffer is a separate problem. I’m not sure why it’s not declared by the
>> externs.
>>
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/File.js:12: WARNING - Redeclared
>> variable: fs
>> var fs = require('fs');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/File.js:12: WARNING - Variable fs
>> first declared in externs/fs.js
>> var fs = require('fs');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/File.js:12: WARNING - constant fs
>> assigned a value more than once.
>> Original definition at externs/fs.js:27
>> var fs = require('fs');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/File.js:13: WARNING - Redeclared
>> variable: path
>> var path = require('path');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/File.js:13: WARNING - Variable path
>> first declared in externs/path.js
>> var path = require('path’);
>>
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/PrefUtils.js:200: WARNING - variable
>> Buffer is undeclared
>> var /** @type {Buffer} */ crypted = Buffer.concat([cipher.update(buffer),
>> cipher.final()]);
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/ZipUtils.js:13: WARNING - Redeclared
>> variable: crypto
>> var crypto = require('crypto');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/ZipUtils.js:13: WARNING - Variable
>> crypto first declared in externs/tls.js
>> var crypto = require('crypto');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/ZipUtils.js:14: WARNING - constant fs
>> assigned a value more than once.
>> Original definition at externs/fs.js:27
>> var fs = require('fs');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/ZipUtils.js:14: WARNING - Redeclared
>> variable: fs
>> var fs = require('fs');
>> ^
>> Nov 22, 2016 10:47:02 PM com.google.javascript.jscomp.LoggerErrorManager
>> println
>> WARNING: /Users/harbs/Documents/git/printui-desktop/PrintUI Management
>> HTML/bin/js-debug/com/printui/utils/ZipUtils.js:14: WARNING - Variable fs
>> first declared in externs/fs.js
>> var fs = require('fs’);
>>
>> On Nov 22, 2016, at 9:26 PM, Harbs <[email protected]> wrote:
>>
>>> OMG!!!
>>>
>>> That was it. Phew! Changing that brought up some (real) errors, and
>> fixing them gave me proper output.
>>>
>>> I guess the question is why the compiler didn’t give a more intelligent
>> error.
>>>
>>> Thanks,
>>> Harbs
>>>
>>> On Nov 22, 2016, at 9:19 PM, Alex Harui <[email protected]> wrote:
>>>
>>>>
>>>>
>>>> On 11/22/16, 2:40 AM, "Harbs" <[email protected]> wrote:
>>>>
>>>>
>>>>> There’s not a lot in the project. Please take a look and let me know if
>>>>> you can spot what’s wrong.
>>>>
>>>> I don't know if this is the only problem, but I did find a problem that
>> I
>>>> should have seen earlier, but I only saw after spending an hour stepping
>>>> through the debugger. Check out the last line of your MXML file. It
>> is:
>>>>
>>>> <js:Application>
>>>>
>>>>
>>>> I haven't changed your code yet since I want to see why the compiler did
>>>> not report an error. But for sure, that's not right. It's amazing that
>>>> we both did not see this earlier. ROFL!
>>>>
>>>> -Alex
>>>>
>>>
>>
>>