Janet 1.4.0-655d4b3 Documentation
(Other Versions: 1.4.0 1.3.1)

Module Module

Index

module/cache module/expand-path module/find module/loaders module/loading module/paths


module/cache table
Table mapping loaded module identifiers to their environments.

module/expand-path cfunction
(module/expand-path path template)

Expands a path template as found in module/paths for module/find. This takes in a path (the argument to require) and a template string, template, to expand the path to a path that can be used for importing files.

module/find function
(module/find path)

Try to match a module or path name from the patterns in module/paths. Returns a tuple (fullpath kind) where the kind is one of :source, :native, or image if the module is found, otherwise a tuple with nil followed by an error message.

module/loaders table
A table of loading method names to loading functions. This table lets require and import load many different kinds of files as module.

module/loading table
Table mapping currently loading modules to true. Used to prevent circular dependencies.

module/paths array
The list of paths to look for modules, templated for module/expand-path. Each element is a two element tuple, containing the path template and a keyword :source, :native, or :image indicating how require should load files found at these paths.

A tuple can also contain a third element, specifying a filter that prevents module/find from searching that path template if the filter doesn't match the input path. The filter can be a string or a predicate function, and is often a file extension, including the period.