superstartup-closure-compiler

raw JSON →
0.1.7 verified Fri May 01 auth: no javascript deprecated

A package providing a compiled .jar of Google Closure Compiler (SHA 579770a, Oct 2013) with an additional custom build that strips goog.debug calls. The package exposes two methods: getPath() and getPathSS() to retrieve paths to the vanilla and custom compiler jars respectively. Version 0.1.7 is the latest. It requires Node >=0.8.0 and is primarily used for JavaScript minification and optimization. Differentiators include a special build that removes debug logging for production builds. Note: the compiler version is very old and unmaintained since 2013, with no updates or security patches.

error Cannot find module 'superstartup-closure-compiler'
cause Package name typo or not installed.
fix
Run: npm install superstartup-closure-compiler
error getPath is not a function
cause Incorrect import: using default import while package exports named methods.
fix
Use: const compiler = require('superstartup-closure-compiler'); then compiler.getPath()
breaking Package uses a very old Closure Compiler build (SHA 579770a, Oct 2013). It may not work with modern JavaScript syntax (ES6+).
fix Migrate to a maintained Closure Compiler package like google-closure-compiler (npm).
deprecated Package is unmaintained since 2013, no updates or security fixes.
fix Switch to an actively maintained closure compiler package.
gotcha Node engine requirement is >=0.8.0, which is extremely outdated. May not run on current Node versions without compatibility issues.
fix Use a newer Node version and check compatibility; consider using a different package.
npm install superstartup-closure-compiler
yarn add superstartup-closure-compiler
pnpm add superstartup-closure-compiler

Demonstrates retrieving the path to the vanilla Closure Compiler jar and executing it via child_process.exec.

const compiler = require('superstartup-closure-compiler');
const { exec } = require('child_process');

const jarPath = compiler.getPath();
const options = '--language_in ECMASCRIPT5 --js output.js --js_output_file output.min.js';
const command = `java -jar ${jarPath} ${options}`;

exec(command, (err, stdout, stderr) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log('Compilation complete:', stdout);
});