Registry / devops / task-closure-tools

task-closure-tools

JSON →
library0.1.10jsnpmunverified

Core library for Google Closure Tools tasks, providing Compiler (JS minification using the Closure Compiler), Builder (concatenation and optional compilation), and DepsWriter (dependency graph generation for deps.js files). Current version 0.1.10, last updated June 2015 (infrequent updates). Primarily used as a base for Grunt plugins (grunt-closure-tools) and other build systems (Mantri). Differentiators: integrates directly with Google Closure Library ecosystem, supports Java-based Closure Compiler and Python-based DepsWriter, but node >=0.8.0 only, no modern ESM support.

npm install task-closure-tools
INSTALL
IMPORT
SIG · TASK-CLOSURE-TOOLS
T
task-closure-tools
devopsjavascriptv0.1.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

taskClosureTools
import taskClosureTools from 'task-closure-tools'
const taskClosureTools = require('task-closure-tools')
Package has no default export; common usage is via grunt plugin or requiring specific submodules.
Compiler
import { Compiler } from 'task-closure-tools'
const Compiler = require('task-closure-tools').Compiler
Named export available; use destructured import in ESM, or access via property in CJS.
Builder
import { Builder } from 'task-closure-tools'
Named export for Builder class.
DepsWriter
import { DepsWriter } from 'task-closure-tools'
Named export for DepsWriter class.

Shows basic usage of Compiler, Builder, and DepsWriter for compilation, bundling, and dependency generation.

import { Compiler, Builder, DepsWriter } from 'task-closure-tools'; // Example: compile a single JS file const compiler = new Compiler({ closureLibraryPath: './node_modules/google-closure-library', bootstrap: false }); compiler.compile({ js: 'src/main.js', compilation_level: 'ADVANCED_OPTIMIZATIONS', js_output_file: 'dist/bundle.min.js', extra_annotation_name: 'api' }, function(err, stdout, stderr) { if (err) { console.error('Compilation failed:', err); } else { console.log('Compilation succeeded:', stdout); } }); // Builder: concatenate dependencies and optionally compile const builder = new Builder({ closureLibraryPath: './node_modules/google-closure-library' }); builder.build({ inputs: 'src/main.js', compile: true, output_file: 'dist/bundle.js' }, function(err, stdout) { if (err) { console.error('Build failed:', err); } else { console.log('Build completed'); } }); // DepsWriter: generate deps.js const depsWriter = new DepsWriter({ closureLibraryPath: './node_modules/google-closure-library' }); depsWriter.writeDeps({ root: ['src', 'test'], output_file: 'dist/deps.js' }, function(err) { if (err) { console.error('Deps write failed:', err); } else { console.log('Deps written'); } });
Debug
Known issues
gotchaPackage last updated June 2015; no longer actively maintained. May have compatibility issues with modern Node.js versions (>=10).
fix
Consider using official Closure Compiler npm package 'google-closure-compiler' or other modern build tools.
affects: >=0.1.10
gotchaRequires Java Runtime Environment (JRE) to run the Closure Compiler and Python to run DepsWriter. Not explicitly mentioned in npm metadata.
fix
Ensure Java and Python are installed and available in PATH.
affects: >=0.1.0
gotchaClosure Library path must be provided manually via options; package does not automatically resolve it.
fix
Install google-closure-library and pass its path (e.g., './node_modules/google-closure-library').
affects: >=0.1.0
gotchaCompiler and Builder options are passed directly to the underlying Java command; incorrect flags may cause silent failures.
fix
Refer to official Closure Compiler documentation for valid compilation_level and other options.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'task-closure-tools'
Package not installed or incorrect import path.
fix
Run `npm install task-closure-tools` and use require('task-closure-tools') or import { ... } from 'task-closure-tools'.
Java not found. Please install Java.
Java Runtime Environment not installed or not in PATH.
fix
Install Java (JRE) version 8 or later and ensure java command is accessible.
python: not found
Python not installed for DepsWriter.
fix
Install Python 2.7 (older, may work) or Python 3 and ensure python command is in PATH.
TypeError: taskClosureTools is not a function
Using default import instead of named exports.
fix
Use named imports: import { Compiler, Builder, DepsWriter } from 'task-closure-tools'.
Error: ENOENT: no such file or directory, open '.../closure-library/closure/goog/base.js'
Closure Library path not correctly configured or missing.
fix
Set closureLibraryPath option to the root of the installed google-closure-library package.
Upgrade
Version history
0.1.10latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
task-closure-tools — npm install task-closure-tools · libregistry