minee (main) doxdox documentation

Earth Engine module bundler.

# loadGitCredentials(dir)

Retrieve locally stored Git credentials. Note, if the Google authentication flow is run multiple times, new credentials are concatenated to the end of the file and old credentials are deactivated. This will always grab the most recent credentials.

Parameters

Name Types Description
dir string The path to the directory containing .gitcookies. By default, the home directory is used.

Returns

string

The credential password for Git access.

# buildHeader(modules)

Build header text for bundled modules.

Parameters

Name Types Description
modules Module[] - The modules to bundle.

Returns

string

The header text.

# Bundle()

Represents a bundled module.

# bundleModule(entry, options, options.header, options.minify, options.keepNames)

Bundle a module into a single file.

Parameters

Name Types Description
entry string - The path to the module entry point, e.g. "users/username/module:script".
options object
options.header boolean - If true, a header will be included in the bundled file with information about the source and license for the bundled modules.
options.minify boolean - If true, the bundled file will be minified.
options.keepNames boolean - If true, all identifiers will be preserved while minifying. Otherwise, minifying will mangle names to reduce file size (without affecting the public API).

Returns

Promise<Bundle>

A promise that resolves to a Bundle object containing the bundled code.

# compressionPercent()

Calculate the percent compression from the original scripts to the bundled, minified output.

Returns

number

The percent compression.

# constructor(code, entry, modules)

Parameters

Name Types Description
code string - The bundled source code.
entry Module - The entry point module.
modules Module[] - All modules in the bundle.

# renameRequires(code, to)

Rename any require identifiers in a code block to avoid the Earth Engine Code Editor making automatic GET requests when it sees them.

Parameters

Name Types Description
code string - A block of code.
to string - The replacement name.

# wrapModule(module, requireIdentifier)

Wrap a module's source code for bundling.

Parameters

Name Types Description
module Module - The module to wrap.
requireIdentifier string - The identifier to use for require calls.

Returns

string

The wrapped source code.

# write(dest, overwrite)

Write the bundled source code to a local file.

Parameters

Name Types Description
dest string - The file path to write to.
overwrite boolean - If true, overwrite the file if it already exists.

# runBundler(entry, dest, noHeader)

Run bundling on an Earth Engine module, writing the results to a local file.

Parameters

Name Types Description
entry string - The path to the module entry point, e.g. users/username/repository:module.
dest string - The local file path to write the bundled module. If none is given, the file will be written to ./.bundled.js.
noHeader boolean - If false, a header will be included in the bundled file with information about the source and license for the bundled modules.

# loadConfig()

Load bundling options from a local config file, swapping in defaults for missing options.

# CircularDependencyError()

Thrown when a circular import dependency is found between two modules.

# constructor(message)

Parameters

Name Types Description
message string - The error message.

# constructor(message, repository)

Parameters

Name Types Description
message string - The error message.
repository Repository - The repository that could not be found.

# constructor(message, path)

Parameters

Name Types Description
message string - The error message.
path string - The Earth Engine path to the module that could not be found.

# constructor(message, moduleA, moduleB)

Parameters

Name Types Description
message string - The error message.
moduleA Module - A module that requires moduleB.
moduleB Module - A module that requries moduleA.

# constructor(message)

Parameters

Name Types Description
message string - The error message.

# constructor(message)

Parameters

Name Types Description
message string - The error message.

# constructor(message, path)

Parameters

Name Types Description
message string - The error message.
path string - The invalid module path.

# GitAuthenticationError()

Thrown when Earth Engine Git authentication fails.

# InvalidCredentialsError()

Thrown when Git credentials cannot be parsed.

# InvalidModulePathError()

Thrown when a module path doesn't follow the valid format.

# MissingCredentialsError()

Thrown when Git credentials cannot be found.

# ModuleNotFoundError()

Thrown when a script cannot be found within an Earth Engine module.

# RepositoryNotFoundError()

Thrown when an Earth Engine repository cannot be accessed through Earth Engine Git.

# checkForCircularImports()

Recursively check for circular imports downstream of this module. Throw if any are found.

# clone(showProgress)

Git clone the module repository into memory.

Parameters

Name Types Description
showProgress boolean - If true, a spinner will display progress.

Returns

Promise<string>

Promise object representing the cloned directory contents.

# constructor(path)

Create an Earth Engine repository from its root path.

Parameters

Name Types Description
path string - The path to the root of the Earth Engine repository, e.g. "users/username/repo".

# dependencyTree(options, options.pretty)

Build a dependency tree from all downstream modules.

Parameters

Name Types Description
options object
options.pretty boolean - If true, colors are included in the dependency tree for terminal output.

# listDependencies()

Get a flat array of all modules required downstream.

# loadDependencies(loaded)

Parse all downstream dependencies and load them.

Parameters

Name Types Description
loaded string[] - An optional list of already loaded module paths. This is used internally to avoid circular dependencies, and should not be passed by users.

# loadModule(entry, options, options.showProgress, options.loadDependencies, options.allowCircular)

Create and load an Earth Engine module from an entry path.

Parameters

Name Types Description
entry string - The path to the entry Earth Engine module, e.g. "users/username/repository:module".
options object
options.showProgress boolean - If true, progress spinners will be when when cloning repositories.
options.loadDependencies boolean - If true, all downstream modules will be loaded and stored in the dependencies property of the loaded module.
options.allowCircular boolean - If true, circular import errors will be ignored when loading dependencies.

# Module()

A Module represents a single Earth Engine source code file.

# Repository()

A Repository contains one or more Earth Engine modules.

# validateModulePath(modulePath)

Check if an Earth Engine module path follows a valid format. This isn't an exhaustive check against Earth Engine filename requirements, but does ensure that the path is at least parseable and contains the correct pieces.

Parameters

Name Types Description
modulePath string - The path to an Earth Engine module, e.g. users/username/repository:module.