Skip to content

API reference / @jsprismarine/native-library / nativeHash

nativeHash ​

Functions ​

hasNativeSources() ​

hasNativeSources(packageDir): boolean

Defined in: nativeHash.ts:32

Whether a package directory holds the native sources, which a checkout does and a published package does not.

Parameters ​

packageDir ​

string

The package's directory.

Returns ​

boolean

True in a checkout.


nativeSourceHash() ​

nativeSourceHash(packageDir, buildScripts, naming): string

Defined in: nativeHash.ts:46

The hash that names a build of a native library. A release of builds is tagged with it, and the manifest records the hash its builds were made from, so a checkout can tell whether its native sources still match the published builds. Every change it sees publishes a new set of builds, so it covers what can change a build and nothing else: the build's input files, and what the shared naming helpers answer rather than their source.

Parameters ​

packageDir ​

string

The package's directory, holding native/.

buildScripts ​

readonly string[]

The files outside native/ the build reads, relative to the package, such as its build script.

naming ​

string

What the shared naming helpers answer, from namingAnswers in ./platform.

Returns ​

string

The first 16 hex digits of the SHA-256 over the build's inputs.