API reference / @jsprismarine/native-worldgen / library
library
Variables
LIBRARY_ENV
constLIBRARY_ENV:string=nativeWorldgenLibrary.libraryEnv
Defined in: library.ts:25
The environment variable that names a library file to load in place of the installed build.
LIBRARY_ENV
constLIBRARY_ENV:string=scriptHostLibrary.libraryEnv
Defined in: script-host/src/library.ts:26
The environment variable that names a library file to load in place of the installed build.
PACKAGE_NAME
constPACKAGE_NAME:string=scriptHostLibrary.packageName
Defined in: script-host/src/library.ts:29
The npm package's name, as the messages name it.
nativeWorldgenLibrary
constnativeWorldgenLibrary:NativeLibrary
Defined in: library.ts:15
The package's native library: its name, its environment variables and its published builds.
scriptHostLibrary
constscriptHostLibrary:NativeLibrary
Defined in: script-host/src/library.ts:16
The package's native library: its name, its environment variables and its published builds.
Functions
approvalAdvice()
approvalAdvice(
platform):string
Defined in: script-host/src/library.ts:43
What to tell a user whose install did not fetch the library: the package managers that hold install scripts back, how to let this one run, and the way around it.
Parameters
platform
string
The platform key.
Returns
string
The advice, as sentences.
bundledManifest()
bundledManifest():
NativeManifest
Defined in: script-host/src/library.ts:35
The manifest this package was built with. It is imported, not read from disk, so a bundled executable carries it.
Returns
installedLibraryPath()
installedLibraryPath(
packageDir,platform?):string
Defined in: script-host/src/library.ts:80
Where a platform's library goes in the package, whether build:native built it or the install script downloaded it.
Parameters
packageDir
string
The package's directory.
platform?
string
The platform key; this machine's by default.
Returns
string
prebuilds/<platform>/<library> under it.
locateLibrary()
locateLibrary(
options?):string
Defined in: library.ts:35
Where the library for this machine is, checked against its published digest: the file JSP_NATIVE_WORLDGEN_LIBRARY names, or the build the install script or build:native put in the package. Finding it builds and downloads nothing.
Parameters
options?
The environment, package, platform and manifest; the defaults are this process's.
Returns
string
The file's path.
Throws
When there is no file, or it is neither the published build nor a local one.
locateLibrary()
locateLibrary(
options?):string
Defined in: script-host/src/library.ts:64
Where the library for this machine is, checked against its published digest: the file JSP_SCRIPT_HOST_LIBRARY names, or the build the install script or build:native put in the package. Finding it builds and downloads nothing.
Parameters
options?
The environment, package, platform and manifest; the defaults are this process's.
Returns
string
The file's path.
Throws
When there is no file, or it is neither the published build nor a local one.
packageRoot()
packageRoot():
string
Defined in: library.ts:12
The package's root: one level above this file in both src/ and dist/.
Returns
string
packageRoot()
packageRoot():
string
Defined in: script-host/src/library.ts:13
The package's root: one level above this file in both src/ and dist/.
Returns
string
sharedLibraryName()
sharedLibraryName(
platform?):string
Defined in: script-host/src/library.ts:71
The file name of the shared library on an operating system.
Parameters
platform?
Platform
The operating system, as process.platform names it.
Returns
string
The file name.
verifyLibrary()
verifyLibrary(
path,platform,manifest):void
Defined in: script-host/src/library.ts:53
Checks a library file against the digest the manifest publishes for the platform, or the one a local build:native recorded beside it.
Parameters
path
string
The file.
platform
string
The platform key.
manifest
The package's manifest.
Returns
void
Throws
When neither digest matches.