dcodeio / closurecompiler.js Goto Github PK
View Code? Open in Web Editor NEWClosure Compiler for node.js - the all-round carefree package.
Home Page: http://dcode.io
License: Apache License 2.0
Closure Compiler for node.js - the all-round carefree package.
Home Page: http://dcode.io
License: Apache License 2.0
I'm getting following error when installing closurecompiler from behind a proxy on windows
HTTPS_PROXY and HTTP_PROXY environment variables are set correctly.
C:\Users\willem.DZINE201>npm install closurecompiler -g
npm http GET https://registry.npmjs.org/closurecompiler
npm http 304 https://registry.npmjs.org/closurecompiler
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/sleep
npm http GET https://registry.npmjs.org/closurecompiler-externs
npm http 304 https://registry.npmjs.org/sleep
npm http 304 https://registry.npmjs.org/tar
npm http 304 https://registry.npmjs.org/closurecompiler-externs
> [email protected] preinstall C:\Users\willem.DZINE201\AppData\Roaming\npm\node_modules\closurecompiler\node_modules\sleep
> node build.js
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/block-stream
npm http GET https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/block-stream
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/graceful-fs
C:\Users\willem.DZINE201\AppData\Roaming\npm\ccjs -> C:\Users\willem.DZINE201\AppData\Roaming\npm\node_modules\closurecompiler\bin\ccjs
> [email protected] postinstall C:\Users\willem.DZINE201\AppData\Roaming\npm\node_modules\closurecompiler
> npm run-script configure
> [email protected] configure C:\Users\willem.DZINE201\AppData\Roaming\npm\node_modules\closurecompiler
> node scripts/configure.js
Configuring ClosureCompiler.js 1.1.2 ...
Downloading http://closure-compiler.googlecode.com/files/compiler-latest.tar.g
z ...
? Download failed: Error: getaddrinfo ENOTFOUND
? Unfortunately, ClosureCompiler.js could not be configured.
See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)
npm ERR! [email protected] configure: `node scripts/configure.js`
npm ERR! `cmd "/c" "node scripts/configure.js"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] configure script.
npm ERR! This is most likely a problem with the closurecompiler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/configure.js
npm ERR! You can get their info via:
npm ERR! npm owner ls closurecompiler
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "configure"
npm ERR! cwd C:\Users\willem.DZINE201\AppData\Roaming\npm\node_modules\closurecompiler
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\willem.DZINE201\AppData\Roaming\npm\node_modules\closurecompiler\npm-debug.log
npm ERR! not ok code 0
npm ERR! [email protected] postinstall: `npm run-script configure`
npm ERR! `cmd "/c" "npm run-script configure"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the closurecompiler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run-script configure
npm ERR! You can get their info via:
npm ERR! npm owner ls closurecompiler
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "closurecompiler" "-g"
npm ERR! cwd C:\Users\willem.DZINE201
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\willem.DZINE201\npm-debug.log
npm ERR! not ok code 0
Going trough the code i think you should probably configure the proxy using system variables somewhere about here:
https://github.com/dcodeIO/ClosureCompiler.js/blob/master/scripts/configure.js#L146
Configuring JRE ...
✔ Global Java is available, perfect!
Except it won't work if that's Java 6, as the compiler now requires Java 7 (not sure which version the bundled JRE is but it might need updating too).
I've created a gulp plugin for Closure Compiler using this excellent module.
Gulp works on streams and buffers and not files while this module requires you to supply files. A lot of other Node things does this too.
It would be useful if you could also supply a buffer that is passed to the Closure Compiler stdin.
Like:
ClosureCompiler.compile(new Buffer('function foo() {}'), {}, function () {});
Right after install I get an error:
C:\Users\xxx\Desktop\xxx\public\js\jquery\dist>ccjs jquery.js
Error: Unable to access jarfile
C:\Users\xxx\AppData\Roaming\npm\node_modules\closurecompiler/compiler/compile r.jar
What does this mean?
I'm running this on a local installation of Node.js and it takes an unholy amount of time on even simple, small scripts. Is this to be expected or is there something wrong with my setup?
I noticed that the version of closure compiler has been updated but not the npm package.
The current version of tar
being used has a vulnerability.
Overview
The tar module earlier than version 2.0.0 allow for archives to contain symbolic links that will overwrite targets outside the expected path for extraction.
Remediation
Update to a version 2.0.0 or greater
On ubuntu 14 system i install 1.6,1 by command npm -g install closurecompiler
get error info:
/usr/bin/ccjs -> /usr/lib/node_modules/closurecompiler/bin/ccjs
[email protected] install /usr/lib/node_modules/closurecompiler
npm run-script configure
[email protected] configure /usr/lib/node_modules/closurecompiler
node scripts/configure.js
Configuring ClosureCompiler.js 1.6.1 ...
Downloading https://dl.google.com/closure-compiler/compiler-latest.tar.gz ...
✖ Download failed: Error: read ECONNRESET
✖ Unfortunately, ClosureCompiler.js could not be configured.
See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)
npm ERR! Linux 3.13.0-100-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run-script" "configure"
npm ERR! node v6.9.2
npm ERR! npm v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] configure: node scripts/configure.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] configure script 'node scripts/configure.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the closurecompiler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/configure.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs closurecompiler
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls closurecompiler
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/lib/node_modules/closurecompiler/npm-debug.log
npm ERR! Linux 3.13.0-100-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "-g" "install" "closurecompiler"
npm ERR! node v6.9.2
npm ERR! npm v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: npm run-script configure
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'npm run-script configure'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the closurecompiler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run-script configure
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs closurecompiler
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls closurecompiler
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /webrtc/apprtc/npm-debug.log
how to fix this ? i have no idea help thks
Error trying to use the bundled JRE on Ubuntu Linux 12.04 with Node 0.8.24 and 0.10.4:
npm http GET https://registry.npmjs.org/closurecompiler
npm http GET https://registry.npmjs.org/send
npm http 200 https://registry.npmjs.org/url
npm http GET https://registry.npmjs.org/url/-/url-0.7.9.tgz
npm http 200 https://registry.npmjs.org/closurecompiler
npm http GET https://registry.npmjs.org/closurecompiler/-/closurecompiler-1.1.0.tgz
npm http 200 https://registry.npmjs.org/url/-/url-0.7.9.tgz
npm WARN package.json [email protected] No README.md file found!
npm http 200 https://registry.npmjs.org/closurecompiler/-/closurecompiler-1.1.0.tgz
npm http 200 https://registry.npmjs.org/send
npm http GET https://registry.npmjs.org/querystring
npm http GET https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mime/1.2.6
npm http 200 https://registry.npmjs.org/querystring
npm http GET https://registry.npmjs.org/sleep
npm http GET https://registry.npmjs.org/closurecompiler-externs
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/querystring/-/querystring-0.1.0.tgz
npm http 200 https://registry.npmjs.org/range-parser/0.0.4
npm http 200 https://registry.npmjs.org/punycode
npm http 200 https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz
npm http GET https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
npm http GET https://registry.npmjs.org/punycode/-/punycode-1.0.0.tgz
npm http 200 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/tar
npm http 200 https://registry.npmjs.org/mime/1.2.6
npm http GET https://registry.npmjs.org/mime/-/mime-1.2.6.tgz
npm http 200 https://registry.npmjs.org/querystring/-/querystring-0.1.0.tgz
npm http 200 https://registry.npmjs.org/closurecompiler-externs
npm http GET https://registry.npmjs.org/closurecompiler-externs/-/closurecompiler-externs-1.0.0.tgz
npm http 200 https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz
npm http 200 https://registry.npmjs.org/sleep
npm http GET https://registry.npmjs.org/sleep/-/sleep-1.1.0.tgz
npm http 200 https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
npm http 200 https://registry.npmjs.org/punycode/-/punycode-1.0.0.tgz
npm http 200 https://registry.npmjs.org/mime/-/mime-1.2.6.tgz
npm http 200 https://registry.npmjs.org/closurecompiler-externs/-/closurecompiler-externs-1.0.0.tgz
npm http 200 https://registry.npmjs.org/sleep/-/sleep-1.1.0.tgz
> [email protected] preinstall /var/www/PeerCDN/node_modules/closurecompiler/node_modules/sleep
> node build.js
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/block-stream
npm http 304 https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/block-stream
npm http 304 https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/rimraf/-/rimraf-2.1.4.tgz
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/mkdirp
npm http 200 https://registry.npmjs.org/rimraf/-/rimraf-2.1.4.tgz
Nothing to clean (project not configured)
Setting srcdir to : /var/www/PeerCDN/node_modules/closurecompiler/node_modules/sleep
Setting blddir to : /var/www/PeerCDN/node_modules/closurecompiler/node_modules/sleep/build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr
'configure' finished successfully (0.358s)
Waf: Entering directory `/var/www/PeerCDN/node_modules/closurecompiler/node_modules/sleep/build'
[1/2] cxx: sleep.cc -> build/Release/sleep_1.o
[2/2] cxx_link: build/Release/sleep_1.o -> build/Release/sleep.node
Waf: Leaving directory `/var/www/PeerCDN/node_modules/closurecompiler/node_modules/sleep/build'
'build' finished successfully (1.903s)
npm WARN prefer global [email protected] should be installed with -g
> [email protected] postinstall /var/www/PeerCDN/node_modules/closurecompiler
> npm run-script configure
> [email protected] configure /var/www/PeerCDN/node_modules/closurecompiler
> node scripts/configure.js
Configuring ClosureCompiler.js 1.1.0 ...
Downloading http://closure-compiler.googlecode.com/files/compiler-latest.tar.gz ...
| 0 / 5 mb
| 1 / 5 mb
| 2 / 5 mb
| 3 / 5 mb
| 4 / 5 mb
| 5 / 5 mb
��� Download complete: /var/www/PeerCDN/node_modules/closurecompiler/compiler/compiler.tar.gz (5 mb)
Unpacking /var/www/PeerCDN/node_modules/closurecompiler/compiler/compiler.tar.gz ...
| compiler.jar
| COPYING
| README
��� Unpack complete.
Configuring JRE ...
��� Global Java not found, we need to download the bundled JRE ...
Downloading http://bundled-openjdk-jre.googlecode.com/files/OpenJDK-JRE-7u6_24.tar.gz ...
| 0 / 43 mb
| 1 / 43 mb
| 2 / 43 mb
| 3 / 43 mb
| 4 / 43 mb
| 5 / 43 mb
| 6 / 43 mb
| 7 / 43 mb
| 8 / 43 mb
| 9 / 43 mb
| 10 / 43 mb
| 11 / 43 mb
| 12 / 43 mb
| 13 / 43 mb
| 14 / 43 mb
| 15 / 43 mb
| 16 / 43 mb
| 17 / 43 mb
| 18 / 43 mb
| 19 / 43 mb
| 20 / 43 mb
| 21 / 43 mb
| 22 / 43 mb
| 23 / 43 mb
| 24 / 43 mb
| 25 / 43 mb
| 26 / 43 mb
| 27 / 43 mb
| 28 / 43 mb
| 29 / 43 mb
| 30 / 43 mb
| 31 / 43 mb
| 32 / 43 mb
| 33 / 43 mb
| 34 / 43 mb
| 35 / 43 mb
| 36 / 43 mb
| 37 / 43 mb
| 38 / 43 mb
| 39 / 43 mb
| 40 / 43 mb
| 41 / 43 mb
| 42 / 43 mb
| 43 / 43 mb
��� Download complete: /var/www/PeerCDN/node_modules/closurecompiler/jre/jre.tar.gz (43 mb)
Unpacking /var/www/PeerCDN/node_modules/closurecompiler/jre/jre.tar.gz ...
| ASSEMBLY_EXCEPTION
| bin_linux/
| bin_linux/java
==========TRUNCATED==========
| THIRD_PARTY_README
��� Unpack complete.
Configuring bundled JRE for platform 'linux' ...
| 0755 /var/www/PeerCDN/node_modules/closurecompiler/jre
| /var/www/PeerCDN/node_modules/closurecompiler/jre/bin_linux -> /var/www/PeerCDN/node_modules/closurecompiler/jre/bin
| 0755 /var/www/PeerCDN/node_modules/closurecompiler/jre/bin/java
Complete.
Testing bundled Java ...
| exec /var/www/PeerCDN/node_modules/closurecompiler/jre/bin/java
��� Failed to call bundled java, trying global java instead ...
| exec java
��� Failed to call global Java.
��� Unfortunately, ClosureCompiler.js could not be configured.
See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)
Hello, I can't find a way to generate a .map file to point to the original unminified JS files for debugging.
Can you please provide an example? Much appreciated.
I see you accepted PR #33. I was wondering when you will push the changes to npm, not sure if you forgot. Thanks!
Is there a way to read stdin / redirect input when using ccjs command line utiliy?
Nailgun is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead.
$ time java com.martiansoftware.nailgun.examples.HelloWorld Hello, world!
real 0m0.132s
user 0m0.080s
sys 0m0.010s
$ git clone https://github.com/martylamb/nailgun.git
$ cd nailgun
$ sed -e 's#<source>1.4</source>#<source>1.8</source>#g' pom.xml >pom.xml
$ sed -e 's#<target>1.4</target>#<target>1.8</target>#g' pom.xml >pom.xml
# Maven build
$ mvn clean
$ mvn compile
$ make
$ time ./ng com.martiansoftware.nailgun.examples.HelloWorld Hello, world!
real 0m0.004s
user 0m0.000s
sys 0m0.000s
Hi,
I would like to try this package. Unfortunately I get the following error, when I run the example code or the command line tool.
Can anyone help?
ccjs lib/File.js
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.google.javascript.jscomp.CommandLineRunner. Program will exit.
It seems like the name of the downloaded jar has changed from compiler.jar
to closure-compiler-v20160713.jar
. The older versions of ClosureCompiler.js
look for compiler.jar
explicitly while 1.6.0
looks for closure-compiler*
. For users that specify their dependency on this library as ^1.5.3
or ~1.5.3
, or any version below, the library doesn't work. It might make sense to pull in the jar finding code that was added in 1.6.0
to a 1.5.x
minor so as not to break frozen builds.
This might not be the best solution and I'm sure you aren't totally in control of this but thought I would put it here for others.
The Closure Compiler supports minimatch-style globs.
https://github.com/google/closure-compiler#compiling-multiple-scripts
Can you add support to ccjs
for this as well?
Blocking issue please take action
Installing the package calls the following URL which now returns 503:
https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bundled-openjdk-jre/OpenJDK-JRE-7u6_24-linux64.tar.gz
Full error stack:
Configuring ClosureCompiler.js 1.6.1 ...
Downloading https://dl.google.com/closure-compiler/compiler-latest.tar.gz ...
| 0 / 6 mb
| 1 / 6 mb
| 2 / 6 mb
| 3 / 6 mb
| 4 / 6 mb
| 5 / 6 mb
| 6 / 6 mb
✔ Download complete: /pipeline/source/node_modules/closurecompiler/compiler/compiler.tar.gz (6 mb)
Unpacking /pipeline/source/node_modules/closurecompiler/compiler/compiler.tar.gz ...
| closure-compiler-v20170521.jar
| COPYING
| README.md
✔ Unpack complete.
Configuring JRE ...
✖ Global Java not found or outdated, downloading bundled JRE ...
Downloading https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bundled-openjdk-jre/OpenJDK-JRE-7u6_24-linux64.tar.gz ...
✖ Download failed: Error: Download failed: HTTP status code 503
✖ Unfortunately, ClosureCompiler.js could not be configured.
See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)
"Please report this problem". That's what i'm doin. Not sure if its the right place to report though.
$ ccjs bin/api lib/api-server.js --language_in=ECMASCRIPT6 > bin/test.js
lib/api-server.js:28: WARNING - unreachable code
const compressOptions = {
^
lib/api-server.js:40: WARNING - unreachable code
const uploadManagerOptions = {
^
lib/api-server.js:48: WARNING - unreachable code
const mongoOptions = {
^
lib/api-server.js:56: WARNING - unreachable code
const authorizationOptions = {
^
lib/api-server.js:64: WARNING - unreachable code
const validatorOptions = {
^
0 error(s), 5 warning(s)
java.lang.RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.
null
Node(EXPR_RESULT): bin/api:31:4
console.log('worker ' + worker.process.pid + ' died');
Parent(BLOCK): bin/api:30:52
cluster.on('exit', function(worker, code, signal) {
at com.google.javascript.jscomp.OptimizeArgumentsArray.tryReplaceArguments(OptimizeArgumentsArray.java:181)
at com.google.javascript.jscomp.OptimizeArgumentsArray.exitScope(OptimizeArgumentsArray.java:126)
at com.google.javascript.jscomp.NodeTraversal.popScope(NodeTraversal.java:685)
at com.google.javascript.jscomp.NodeTraversal.popScope(NodeTraversal.java:676)
at com.google.javascript.jscomp.NodeTraversal.traverseBlockScope(NodeTraversal.java:629)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:572)
at com.google.javascript.jscomp.NodeTraversal.traverseFunction(NodeTraversal.java:618)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:569)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:578)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:578)
at com.google.javascript.jscomp.NodeTraversal.traverseBlockScope(NodeTraversal.java:627)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:572)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:578)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:578)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:578)
at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:289)
at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:535)
at com.google.javascript.jscomp.OptimizeArgumentsArray.process(OptimizeArgumentsArray.java:91)
at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:285)
at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:217)
at com.google.javascript.jscomp.Compiler.optimize(Compiler.java:1961)
at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:752)
at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:92)
at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:638)
at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:635)
at com.google.javascript.jscomp.Compiler$4.call(Compiler.java:682)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
... 31 more
When installing from NPM, the shebang line of ccjs
is #!/usr/bin/env node\r\n
The carriage return makes it fail. Invocation fails with the message
env: node\r: No such file or directory”
^^^
The source version does not suffer from this problem, so maybe the publishing pipeline introduces the problem somehow.
I'm facing out of memory error on my laptop running OS X Yosemite with 16 gigabyte of RAM.
I've intentded to compile my javascript app (172k lines). I've tried both SIMPLE_OPTIMIZATION
and ANDVANCED_OPTIMIZATION
.
Output listing:
$ ccjs ./static/ui.jsexe/all.js --compilation_level=ADVANCED_OPTIMIZATIONS > ./static/ui.jsexe/all.min.js
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2245)
at java.util.Arrays.copyOf(Arrays.java:2219)
at java.util.ArrayList.grow(ArrayList.java:213)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:187)
at java.util.ArrayList.add(ArrayList.java:411)
at com.google.javascript.jscomp.parsing.NewIRFactory.<init>(NewIRFactory.java:241)
at com.google.javascript.jscomp.parsing.NewIRFactory.transformTree(NewIRFactory.java:289)
at com.google.javascript.jscomp.parsing.ParserRunner.parse(ParserRunner.java:106)
at com.google.javascript.jscomp.JsAst.parse(JsAst.java:84)
at com.google.javascript.jscomp.JsAst.getAstRoot(JsAst.java:50)
at com.google.javascript.jscomp.CompilerInput.getAstRoot(CompilerInput.java:118)
at com.google.javascript.jscomp.Compiler.hoistNoCompileFiles(Compiler.java:1500)
at com.google.javascript.jscomp.Compiler.parseInputs(Compiler.java:1404)
at com.google.javascript.jscomp.Compiler.parse(Compiler.java:788)
at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:743)
at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:93)
at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:655)
at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:652)
at com.google.javascript.jscomp.Compiler$4.call(Compiler.java:699)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
When running ccjs
from the command line, it will return exit status "0" (Success) even when there were errors.
It should return some other exit status to indicate an error
$ ccjs test.js && echo "SUCCESS"
... snip ...
_build/all.js:2214: ERROR - Parse error. identifier is a reserved word
while (k < final) {
^
11 error(s), 0 warning(s)
SUCCESS
Hey,
today I just rewritten my gulp plugin that uses your awesome ClosureCompiler.js library, and the code it's much better, readable and gulp-friendly as well (no dirty hacks!).
But I'm having a strange issue: when I call my single 'js' task as gulp js
everything works good; If i try to call all the tasks using gulp
, somehow your callback gets lost.
Maybe you know something that I'm missing?
Source code of my plugin: https://github.com/julianxhokaxhiu/gulp-closurecompiler/blob/master/gulp-closurecompiler.js
Gulp example configuration:
// Compile and uglify Javascript
gulp.task('js', function() {
return gulp
.src(
'assets/js/*.js'
)
.pipe(
gulpCC({
fileName: 'main.js'
})
)
.pipe(
gulp.dest( 'assets/out/js/' )
)
});
gulp.task('clean', [
...
'js',
...
], function(cb){
del([
'assets/tmp'
], cb);
});
gulp.task('default', [
'clean'
]);
Thanks in advice for any help :)
Due to release notes July 13, 2016 there is new compiler jar file naming system. There should be added something like
//line 166
var compilerFile = '';
fs.readdirSync(__dirname + '/compiler').forEach(function(file) {
if (file.indexOf('closure-compiler') !== -1) {
compilerFile = file;
}
})
var args = ['-XX:+TieredCompilation'];
if (xms) args.push('-Xms'+xms);
args.push(
'-Xmx'+xmx,
'-jar', __dirname+'/compiler/' + compilerFile
);
into ClosureCompiler.js
The problem is in the following:
function download(downloadUrl, filename, callback, ondata) {
var url = require("url").parse(downloadUrl);
var out = require("fs").createWriteStream(filename, { flags: 'w', encoding: null, mode: 0666 });
var bytes = 0, total = -1;
var req = require(path.join(__dirname, "..", "lib", "follow-redirects.js")).http.request({
"hostname": url["host"],
"method": "GET",
"path": url["path"],
"agent": false
}, function(res) {
if (res.headers["content-length"]) {
total = parseInt(res.headers["content-length"], 10);
}
if (res.statusCode != 200) {
res.setEncoding(null);
callback(new Error("Download failed: HTTP status code "+res.statusCode), -1);
return;
}
res.on("data", function(chunk) {
bytes += chunk.length;
if (ondata) ondata(chunk.length, total);
out.write(chunk);
});
res.on("end", function() {
callback(null, bytes);
});
});
req.on("error", function(e) {
callback(e, -1);
});
req.end();
}
Particularly:
var req = require(path.join(__dirname, "..", "lib", "follow-redirects.js")).http.request({
"hostname": url["host"],
"method": "GET",
"path": url["path"],
"agent": false
where the hostname and path are ignoring the proxy.
Hi,
my project has the following structure:
index.js
compile.js
lib/
-- Class1.js
-- Class2.js
package.json
In compile.js the compiler is invoked with index.js and all files in the lib-directory as source files. Compilation works as expected.
But when I invoked the compiled source file, cross-references between Class1.js and Class2.js cannot be found. The following error occurs:
module.js:340
throw err;
^
Error: Cannot find module './Class1.js'
In Class2.js there is a reference to Class1.js with require(''./Class1.js').
I could use absolute paths by setting an environment-variable in index.js and reading this in every require-statement. But I would like to know which is the best-practice solution for this problem.
The special case of "node" for externs input assumes a nested node_modules hierarchy that doesn't necessarily exist in npm v3's flat dir listing.
Hey,
I was trying to install your package this morning using latest NPM 2.1.7 and I encountered this error:
npm ERR! notarget No compatible version found: jsdoc@'>=3.3.0 <3.4.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.0.0","3.2.0-dev","3.2.0","3.2.1","3.2.2","3.3.0-alpha1","3.3.0-alpha2","3.3.0-alpha3","3.3.0-alpha4","3.3.0-alpha5","3.3.0-alpha7","3.3.0-alpha8","3.3.0-alpha9","3.3.0-alpha10"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
Reading elsewhere I found that this is an issue that was changed between NPM 1.x and 2.x. I've found also someone that already fixed it for both of them, you can see the issue here: krampstudio/grunt-jsdoc#102
Can you fix also yours?
Thanks in advice.
ccjs should pipe stdin through to the closure compiler process.
Hi.
Link in the jrePrefix
is no longer valid. Files are located now under https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bundled-openjdk-jre/
.
in lib/follow-redirects.js line 128:
`
// Make a new option object for next request from old options object
// Break url in parts
var searchname = url.parse(redirectUrl).search;
var hostname = url.parse(redirectUrl).hostname;
var pathname = url.parse(redirectUrl).pathname;
var redirectOptions = options;
redirectOptions.reqUrl = redirectUrl;
redirectOptions.hostname = hostname;
redirectOptions.path = pathname + searchname;
var out = module.exports[proto].get(redirectOptions, redirectCallback(reqUrl, redirect), redirect);
`
when searchname
is null ,it will download from http://120.52.72.22:80/dl.google.com/c3pr90ntc0td/closure-compiler/compiler-latest.tar.gznull
please fix this bug with :
redirectOptions.path = pathname + (searchname? searchname: '');
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.