hash-for-dep

WebJar for hash-for-dep

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

hash-for-dep
Last Version

Last Version

1.5.1
Release Date

Release Date

Type

Type

jar
Description

Description

hash-for-dep
WebJar for hash-for-dep
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/stefanpenner/hash-for-dep

Download hash-for-dep

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/hash-for-dep/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>hash-for-dep</artifactId>
    <version>1.5.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/hash-for-dep/
implementation 'org.webjars.npm:hash-for-dep:1.5.1'
// https://jarcasting.com/artifacts/org.webjars.npm/hash-for-dep/
implementation ("org.webjars.npm:hash-for-dep:1.5.1")
'org.webjars.npm:hash-for-dep:jar:1.5.1'
<dependency org="org.webjars.npm" name="hash-for-dep" rev="1.5.1">
  <artifact name="hash-for-dep" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='hash-for-dep', version='1.5.1')
)
libraryDependencies += "org.webjars.npm" % "hash-for-dep" % "1.5.1"
[org.webjars.npm/hash-for-dep "1.5.1"]

Dependencies

compile (6)

Group / Artifact Type Version
org.webjars.npm » resolve-package-path jar [1.0.11,2)
org.webjars.npm : path-root jar [0.1.1,0.2)
org.webjars.npm : heimdalljs jar [0.2.3,0.3)
org.webjars.npm : broccoli-kitchen-sink-helpers jar [0.3.1,0.4)
org.webjars.npm : heimdalljs-logger jar [0.1.7,0.2)
org.webjars.npm : resolve jar [1.10.0,2)

Project Modules

There are no modules declared in this project.

hash-for-dep Build Status Build status

Generate a hash representing the stats of this module files and all its descendents files.

var hashForDep = require('hash-for-dep');

hashForDep('rsvp'); // if RSVP is a dependency of the current project, you will get a checksum for it
hashForDep('rsvp', 'path/to/other/project'); //  you will get a checksum for RSVP resolved relative to the provided root

What does Hash For Dep consider a dependency?

HashForDep respects the node resolution algorithim.

For example given:

foo/package.json
foo/index.js
foo/node_modules/a/
foo/node_modules/a/package.json
foo/node_modules/a/index.js
foo/node_modules/a/node_modules/b
foo/node_modules/a/node_modules/b/package.json
foo/node_modules/a/node_modules/b/index.js
foo/node_modules/a/node_modules/f
foo/node_modules/a/node_modules/f/index.js
foo/node_modules/a/node_modules/f/package.json
foo/node_modules/c
foo/node_modules/c/index.js
foo/node_modules/c/package.json
foo/node_modules/d
foo/node_modules/d/index.js
foo/node_modules/d/package.js

where foo/package.json depends on a and c but not d and foo/node_modules/a/package.json depends on b not f

HashForDep will consider: a c b as dependencies, and simply ignore d and f. When HashForDep considers a dependency, it will stat each of its files and those of its dependencies.

Cache

NOTE: By default, these hashes are cached for the life of the process. As this is the same strategy node uses for require(x) we can safely follow suit.

That being said, some scenarios may exist where this is not wanted. So just like require._cache exists, we provide the following options:

To evict the cache manually (maybe for testing)

require('hash-for-dep')._resetCache();

To opt out of the cache on a per invocation basis

var hashForDep = require('hash-for-dep');

hashForDep(name, path, null, false /* this mysterious argument should be set to false */);

Versions

Version
1.5.1
1.2.3