Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
google-closure-deps
Advanced tools
Readme
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 21,008 weekly downloads. As such, google-closure-deps popularity was classified as popular.
We found that google-closure-deps demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.