Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
google-closure-deps
Advanced tools
Library to parse dependencies for Closure Library. Also includes a CLI to generate deps.js files for Closure Library's debug loader.
This is a separate utility node package for Closure Library related to dependency management with Closure files.
For more information on Closure Library visit the Google Developers or GitHub sites.
This is meant to replace similar Python scripts that already exist in Closure Library. We're JavaScript deps and should be providing tooling written in JavaScript, where possible! Those Python tools will continue to exist but will not be updated and should be considered deprecated.
Install via npm:
npm install google-closure-deps
To use the CLI below from any directory install the package globally:
npm install -g google-closure-deps
closure-make-deps
is a utility to produce a dependency file for Closure
Library's debug code loader. Closure Library is capable of loading code in a web
browser or in Node but must know the dependency graph ahead of time. Generally
this is done by loading Closure's base.js file and then loading a dependency
file containing repeated calls to goog.addDependency`. Closure comes bundled
with a file named deps.js for itself and is capable of auto loading this file.
get-js-version
is a generally useful utility that determines the highest level
version of a JavaScript program from stdin. The output format is determined by
the Closure Compiler's FeatureSet#version method and should match what
goog.addDependency
expects for a lang
load flag.
$ echo "const foo = 0;" | get-js-version
es6
This Node module also exposes standard functions to parse Closure files and retrieve a dependency graph.
This is an in-code example for clarity, but there are also functions to parse files rather than strings.
const {parser, depGraph} = require('google-closure-deps');
// A file that provides "goog" is required for any file that references Closure.
// Usually this is Closure's base.js file.
const goog = parser.parseText('/** @provideGoog */', '/base.js').dependencies;
const firstFile =
parser.parseText(`goog.module('first.module')`, '/first.js').dependencies;
const secondFile = parser.parseText(`
goog.module('second.module');
const firstModule = goog.require('first.module');
`, '/second.js').dependencies;
const graph = new depGraph.Graph([...goog, ...firstFile, ...secondFile]);
graph.order(...secondFile); // [goog, firstFile, secondFile]
graph.depsBySymbol.get('first.module'); // firstFile
graph.depsByPath.get('/second.js'); // secondFile
This also supports parsing ES6 modules now that Closure Library has support for them!
const {parser, depGraph} = require('google-closure-deps');
// A file that provides "goog" is required for any file that references Closure.
// Usually this is Closure's base.js file.
const goog = parser.parseText('/** @provideGoog */', '/base.js').dependencies;
const firstFile = parser.parseText(
`
goog.declareModuleId('first.module');
export const FOO = 'foo';
`, "/first.js").dependencies;
const secondFile = parser.parseText(
'import {FOO} from "./first.js";',
'/second.js').dependencies;
const thirdFile = parser.parseText(
`
goog.module("third.module");
const firstModule = goog.require("first.module");
`, '/third.js').dependencies;
const graph = new depGraph.Graph([...goog, ...firstFile, ...secondFile, ...thirdFile]);
graph.order(...secondFile, ...thirdFile); // [goog, firstFile, secondFile, thirdFile]
FAQs
Library to parse dependencies for Closure Library. Also includes a CLI to generate deps.js files for Closure Library's debug loader.
The npm package google-closure-deps receives a total of 7,262 weekly downloads. As such, google-closure-deps popularity was classified as popular.
We found that google-closure-deps demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.