npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details


  • User packages



Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.


Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2020 – Pkg Stats / Ryan Hefner




Check, compile, transpile, optimize and compress JavaScript with Closure Compiler in JS





This is a (hopefully temporary) fork of closure-compiler-js that points to my fork of closure-compiler.

It only includes this change:



Check, compile, transpile, optimize and compress JavaScript with Closure Compiler in JS.

This repo tracks issues related to the publication to and associated plugins. Any bugs not related to the plugins themselves should be reported to the main repository.

Unlike other packages, this allows Closure Compiler to run entirely in JS. Java is not required.

This is an experimental release - meaning some features are not available and performance may not be on-par with the Java implementation - details here.


First, install the latest version:

yarn add google-closure-compiler-js  # or
npm install --save google-closure-compiler-js

The module supports modern web browsers as well as Node v4 LTS, and provides compile as a low-level method to compile JavaScript. By default, this compiles ES6 to ES5 and includes the default set of ECMAScript externs files. For example:

const compile = require('google-closure-compiler-js').compile;

const flags = {
  jsCode: [{src: 'const x = 1 + 2;'}],
const out = compile(flags);;  // will print 'var x = 3;\n'

Or to install the command-line version, do:

npm install -g google-closure-compiler-js

You should now be able to run google-closure-compiler-js as a command. The google-closure-compiler-js command can read from stdin or from a file. For example:

google-closure-compiler-js code.js > minified.js

Run google-closure-compiler-js --help for full usage information.

Build Systems


Your webpack.config.js should look like this:

const ClosureCompiler = require('google-closure-compiler-js').webpack;
const path = require('path');

module.exports = {
  entry: [
    path.join(__dirname, 'app.js')
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'app.min.js'
  plugins: [
    new ClosureCompiler({
      options: {
        languageIn: 'ECMASCRIPT6',
        languageOut: 'ECMASCRIPT5',
        compilationLevel: 'ADVANCED',
        warningLevel: 'VERBOSE',


Your gulpfile.js should contain a task like this:

const compiler = require('google-closure-compiler-js').gulp();

gulp.task('script', function() {
  return gulp.src('./path/to/src.js', {base: './'})
      // your other steps here
          compilationLevel: 'SIMPLE',
          warningLevel: 'VERBOSE',
          outputWrapper: '(function(){\n%output%\n}).call(this)',
          jsOutputFile: 'output.min.js',  // outputs single file
          createSourceMap: true,


angularPassfalseGenerate $inject properties for AngularJS for functions annotated with @ngInject
applyInputSourceMapstrueCompose input source maps into output source map
assumeFunctionWrapperfalseEnable additional optimizations based on the assumption that the output will be wrapped with a function wrapper. This flag is used to indicate that "global" declarations will not actually be global but instead isolated to the compilation unit. This enables additional optimizations.
checksOnlyfalseDon't generate output. Run checks, but no optimization passes.
compilationLevelSIMPLESpecifies the compilation level to use. Options: WHITESPACE_ONLY, SIMPLE, ADVANCED
definesnullOverrides the value of variables annotated with @define, an object mapping names to primitive types
envBROWSERDetermines the set of builtin externs to load. Options: BROWSER, CUSTOM
generateExportsfalseGenerates export code for those marked with @export.
languageInES6Sets what language spec that input sources conform to.
languageOutES5Sets what language spec the output should conform to.
newTypeInffalseChecks for type errors using the new type inference algorithm.
outputWrappernullInterpolate output into this string, replacing the token %output%
polymerVersionnullSpecify the Polymer version pass to use.
processCommonJsModulesfalseProcess CommonJS modules to a concatenable form, i.e., support require statements.
renamePrefixNamespaceSpecifies the name of an object that will be used to store all non-extern globals.
rewritePolyfillsfalseRewrite ES6 library calls to use polyfills provided by the compiler's runtime.
useTypesForOptimizationfalseEnable or disable the optimizations based on available type information. Inaccurate type annotations may result in incorrect results.
warningLevelDEFAULTSpecifies the warning level to use. Options: QUIET, DEFAULT, VERBOSE
jsCode[]Specifies the source code to compile.
externs[]Additional externs to use for this compile.
createSourceMapfalseGenerates a source map mapping the generated source file back to its original sources.


The Closure Compiler supports the following languages:

  • ECMASCRIPT6_TYPED (experimental)
  • ECMASCRIPT_2017 (experimental)

Source Code

Unless you're using Gulp's or Webpack's plugins, you'll need to specify code via flags:

  • Both jsCode and externs accept an array containing objects in the form {src, path, sourceMap}.
  • Using path you can construct a virtual filesystem for use with ES6 or CommonJS imports although for CommonJS you'll have to set processCommonJsModules: true.


The JavaScript version of the Closure-Compiler is transpiled by GWT from the Java source. For more details on the differences in behavior see the super sourced files in the main repository.

Version History

Closure Compiler release notes can be found on the main repository wiki.


Copyright © 2017 The Closure Compiler Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.